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

@Venkata_Swami

1 Like

[0-9]+(?=\s+-)
image
Try with this!

Cheers!

Hi,

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.