I have these two examples of strings :
/news/uk-news/commuter-who-extraordinary-row-woman-12345
/news/weird/dude-who-killed-14-extraordinary-98765.amp
I want to get only the last numbers, 12345
and 98765
, respectively.
In the middle of the string, there may be other numbers. And in the end, they may have other characters (or not) that are not numbers. What I really wanted was the last numbers, after the last hyphen -
.
I tried with (\w+-)(\d+)(\W*)
, but returned only a part. Can someone please help me with a correct solution?