reporting service regular expression


=System.Text.RegularExpressions.Regex.Replace(Fields!Phone.Value, "(\d{3})[ -.]*(\d{3})[ -.]*(\d{4})", "($1) $2-$3")

when i add the expression i get a squerrel underline at "Replace"

i think i need to add a reference but which ?

LVL 18
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

No, you can use it without a reference.
In tis instance the red squiggle is an SSRS problem, not a problem with your code - it can't parse the .Net framework and validae the function name at design time, so it squiggles. It does the same thing with custom code functions.
If you try and run the report it should work fine.
vbturboAuthor Commented:
Using this in my expression generation i just get errors down the column rows

'format and convert date to string
'match all strings that is = 01-01-0001 and replace them with string = test
=System.Text.RegularExpressions.Regex.Replace(Fields!udstedelsesdato.Value, ("\b01-01-0001\b") , "test"))

where am i dropping the ball ?

vbturboAuthor Commented:
=System.Text.RegularExpressions.Regex.Replace(Fields!udstedelsesdato.Value, "\b01-01-0001\b" , "test").ToString()

produces this error : #Error

though i have validated the regex expression and it works fine
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

You've got a few too many parenthesis in there, try this
  =System.Text.RegularExpressions.Regex.Replace(Fields!udstedelsesdato.Value, "\b01-01-0001\b", "test")

However, that assumes that your udstedelsesdato field is a string, formatted exactly as you expect. If you combine your two statements you get
  =System.Text.RegularExpressions.Regex.Replace(CDate(Fields!udstedelsesdato.Value).ToString("dd-MM-yyyy"), "\b01-01-0001\b", "test")

Which I think is what you're after

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Try using a proper date not in the year 0001
I think SSRS will generate a cast error as it doesn't recognise 0001 as a valid year
vbturboAuthor Commented:
<Try using a proper date not in the year 0001
<I think SSRS will generate a cast error as it doesn't recognise 0001 as a valid year

this is because its a null value.
but it get represented as "0001" in the report (01-01-0001)

but your expression works great....thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
DB Reporting Tools

From novice to tech pro — start learning today.