I'm trying to extract a number from a string. The string is randomized but must contain one keyword, let's say 'key', and a number. I want to extract the first number behind the keyword.
Below is a sample string:
123samples45have'key'andnumber678and90
So in this sample string, number 678
is required.
I write the expression like (?<=key.*?)[0-9]+
, but it appears Ruby only support fixed length look-behind. Is there any other solution could solve this?