regularExpression in SSRS report?

hi,

It looks like I could use the =System.Text.RegularExpressions.Regex.Replace(Fields!Phone.Value, "(\d{3})[ -.]*(\d{3})[ -.]*(\d{4})", "($1) $2-$3") in SSRS 2005 report.
But when I try to do it, =System.Text. didnot have the RegularExpressions object.
It doesn't show up in the dropdown.

I have this field in this format ((xxxxxx*)) xxxxx*, I want to grab the ((xxxx)) part using the regular expression. I want to look for (( & )) and grab everything between them.

Thanks.

dkim18Asked:
Who is Participating?
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.

Megan BrooksSQL Server ConsultantCommented:
You can reference the regular expression classes in custom code. For example, if you add the function below to the "Code" section of Report Properties then you can call it with an expression like

=Code.RE("..","abc")
The actual string returned by this expression is "ab".
 

    Function RE(ByVal p As String, ByVal i As String) As String
        Dim r As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex(p)
        Dim m As System.Text.RegularExpressions.Match = r.Match(i)
        Return m.Value
    End Function

Open in new window

0

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
planoczCommented:
Here is a sample you can use
It is set to look for Number length from 1 to 5
System.Text.RegularExpressions
 
Public Sub FindBetween(ByVal strIn As String)
        ' Define a regular expression for repeated Numbers. 
        Dim regexParser As Regex = New Regex("\b[0-9]{1,5}\b", RegexOptions.Multiline)
        For Each matchCurrent As Match In regexParser.Matches(strIn)
            Dim valueString As String = matchCurrent.Value.ToString
            Console.WriteLine(valueString)
        Next
    End Sub

Open in new window

0
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
C#

From novice to tech pro — start learning today.