Extract number from string in Ruby
- by Oscar Reyes
I'm using this code:
s = line.match( /ABCD(\d{4})/ ).values_at( 1 )[0]
To extract numbers from strings like:
ABCD1234
ABCD1235
ABCD1236
etc.
It works, but I wonder what other alternative I have to to this in Ruby?