Regex for this string

abc aklsjdfh asjkdh s (12323)

i want to get two values from this
name - abc aklsjdfh asjkdh s
number - 12323


Try this.

To find letters - [a-zA-Z]+
To find Numbers - \d+

1 Like


How about the following?

Name: System.Text.RegularExpressions.Regex.Match(strData,"[\w\s]*\w(?=\s*\()")

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


Name: System.Text.RegularExpressions.Regex.Match(Variable,“\w+\s”)
Number: System.Text.RegularExpressions.Regex.Match(Variable,“\d+”)


Its just giving me the first word i want all words in name - abc aklsjdfh asjkdh s


I didn’t provided this.

Have you tried this ?

yes but its not giving me full name just the first word


Name: ([a-zA-Z]| )+
Number: (?<=()(\d+)(?=))



Please check this and it’s working fine.

Its working for me

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