Regular Expressions 101

@regex101
Donate
Sponsor
Contact
Bug Reports & Feedback
Wiki
Whats new?

Save & Share

  • Save Regex
    ctrl+s
  • Update Regex
    ctrl+⇧+s

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python 2.7
  • Golang (RE2)

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
^.*?(?=\b\d*(?i)[a-z]{2,}\b)
/
gmx
^ asserts position at start of a line
.*?
matches any character (except for line terminators)
*? Quantifier — Matches between zero and unlimited times, as few times as possible, expanding as needed (lazy)
Positive Lookahead
(?=\b\d*(?i)[a-z]{2,}\b)
Assert that the Regex below matches
\b assert position at a word boundary: (^\\w|\\w$|\\W\\w|\\w\\W)
\d*
matches a digit (equal to [0-9])
* Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
(?i)
match the remainder of the pattern with the following effective flags: gmxi
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
Match a single character present in the list below
[a-z]{2,}
{2,} Quantifier — Matches between 2 and unlimited times, as many times as possible, giving back as needed (greedy)
a-z a single character in the range between a (index 97) and z (index 122) (case insensitive)
\b assert position at a word boundary: (^\\w|\\w$|\\W\\w|\\w\\W)
Global pattern flags
g modifier: global. All matches (don't return after first match)
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
x modifier: extended. Spaces and text after a # in the pattern are ignored
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
gmx

Test String

Substitution

Processing...