> I have a fairly easy question. I want to match numbers that occur ONLY > at the end of a string. For example, I have the following string: > > String = 'NR1 MGT - 61 HOURS' > > I have written the following code to pull out the number '61' using the > '$' to try to match the number at the end of the string: ...
But the number _isn't_ at the end of the string--the character string 'HOURS' is at the end.
I'm no regexp user but '$' doesn't return the last occurrence of a match in a strung but the match _followed_immediately_ by the \n sequence.
You need a search from the end to then find the first full word that is numeric it would appear. I don't know enough regexp otomh to do it on the fly, sorry...but as you've discovered '$' isn't that.