0
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 just want to get the latest numbers, 12345
and 98765
, respectively.
In the middle of the string, there may be other numbers. And at the end, there may be other characters (or not) that are not numbers. What I’d really like is the latest 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?
solved! Thank you very much!
– Ricardo Belchior
this business of lookaround is potent!
– Ricardo Belchior
rs.. truth. Facilitates a lot.
– Sam