String Manipulation using Regular expression

Hi
I want to extract JXN-11107-1 , 11107 from my variable
The variable value varies everytime,
These are samples
ALA-56748-0
Lou-7634216-1
can you suggest me regular expression that gives me result 11107, 56748, 7634216 from these sample variables

Hi,

How about the following expression?

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

Regards,

1 Like

Hi @Aima_Arif ,

You can easily achieve this using Split function.

Split(Split(“JXN-11107-1”,“-”)(1),“-”)(0).ToString

image

Hope it helps.

1 Like

@Aima_Arif ,
Try this

Split(Split("JXN-11107-1","-")(1),"-")(0)

image

Regards,

Hi @Aima_Arif

Try this

"XN-11107-1".Split({"-"},stringsplitoptions.none)(1)

image

Hope this helps.

Hello @Aima_Arif
Try this

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=\S)\d+(?=\S)").Tostring.Trim

image