Need Particular String value from complete String

Hello I have a string value ‘Assistant Project Manager - R123456’.
From the above string I just need ‘R123456’.

Can you please tell me any expression or Regex. To get the exact string value

Thanks

1 Like

Hey @Gagan_Chaudhari

Here it is,

R\d+

If the digits are fixed in length

R\d{6}

You can enable case insensitive and multi line flag as required

Thanks
#nK

Hi,

We can write various patterns depending on your requirements.

For example,

Last word

System.Text.RegularExpressions.Regex.Match(yourString,"\w+$").Value

After - and space

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

and so on

Regards,

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