I am in shell and I have this string:
12 BBQ ,45 rofl, 89 lol
You can do this with GNU grep's perl mode:
echo "12 BBQ ,45 rofl, 89 lol"|grep -P '\d+ (?=rofl)' -o
-P means Perl-style, and -o means match only.