0

My RegEx "FUN(\d{0,20})" captures a bit more than intended. It should return just the number following the specific tag "FUN". How can I alter it to avoid numbers following "WordsEndingWithFUN"? See example below. Case sensitivity is not important here.

FUN12|, blaFUN123        # matched 12
ooopsFUN12 ; FUN1245     # matched 1245
ooopsFUN ; FUN13         # matched 13
FUN, blaFUN123           # nothing is matched
blaFUN123                # nothing is matched
Oleg Melnikov
  • 3,080
  • 3
  • 34
  • 65
  • Please tag with the language you are using. Most likely, you just need to make your regex applied globally, or just keep matching until you hit what you want to match. – Tim Biegeleisen Aug 11 '17 at 01:45

1 Answers1

2

Add a word boundary, and change the condition to include at least 1 digit:

\bFUN(\d{1,20})
Robby Cornelissen
  • 91,784
  • 22
  • 134
  • 156