Regex with only numbers

I need only numbers before the hypen (-)
I have given the regex expression like this but not working this [0-9]+ but selected all the number s

Can any one help

AKLP7890455 - LPRJ7890455

You can try this it will work


1 Like

Try with this!



You can use below expression

extractedNumbers = System.Text.RegularExpressions.Regex.Match(yourInputString, “\d+(?=\s*-)”).Value

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