How to take last sentence or number in regex

Hi
i want always the last last digit num through regex

ex - hello my name123israju45678
in this example i want 45678 as results
this sentence is always separated by*

use regex to extract the data

\d+$

image

strNumber = System.Text.RegularExpressions.Regex.Match(strValue,"\d+$").Value.Trim

Regards,
Arivu

1 Like

Hi @T_Y_Raju ,

Could you Check with the below Expression :

Regex.Match("hello my name123israju45678","\d+",RegexOptions.RightToLeft).Value

Let us know if it does not work as expected.

HI @T_Y_Raju

How about this expression?

System.Text.RegularExpressions.Regex.Match(strValue,"\d+(?<=$)").ToString

image

Regards
Gokul

it worked thank you

it worked thank you as expected

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