I am in shell and I have this string: 12 BBQ ,45 rofl, 89 lol
Using the regexp: \d+ (?=rofl)
, I want 45
as a result.
Is it correct to use regex to extract data from a string? The best I have done is to highlight the value in some of the online regex editor. Most of the time it remove the value from my string.
I am investigating expr
, but all I get is syntax errors.
How can I manage to extract 45 in a shell script?