Regular Expression to get number before

Hi,

I have the generic value 77(86.5%)

I want to return the number before the brackets. ie. 77

Thanks for the help

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Match(strData,"\d+(?=\()").Value

Regards,

no not returning anything.

acceptedValue is the variable i am working with

it is a generic value as if i read it in as a string it will appear as 77/r/n(86.5%)

image

Hi,

it is a generic value as if i read it in as a string it will appear as 77/r/n(86.5%)

How about the following expression?

System.Text.RegularExpressions.Regex.Match(strData,"\d+(?=\s*\()").Value

Regards,

1 Like

Hi,

Why you don’t try split the string with the bracket as delimiter and take the first part of the array ?

Ex :
String = Split(Value,Delimiter)
String[0]

It’s less “sexy” than a regex but it could work.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.