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
/
^(?=[a-zA-Z]{7}$)(.)(?!\1)(.)(?!\1)(?!\2)(.)\2(?!\1)(?!\2)(?!\3).\2\1$
/
gm
^ asserts position at start of a line
Positive Lookahead
(?=[a-zA-Z]{7}$)
Assert that the Regex below matches
Match a single character present in the list below
[a-zA-Z]{7}
{7} Quantifier — Matches exactly 7 times
a-z a single character in the range between a (index 97) and z (index 122) (case sensitive)
A-Z a single character in the range between A (index 65) and Z (index 90) (case sensitive)
$ asserts position at the end of a line
1st Capturing Group
(.)
. matches any character (except for line terminators)
Negative Lookahead
(?!\1)
Assert that the Regex below does not match
\1 matches the same text as most recently matched by the 1st capturing group
2nd Capturing Group
(.)
. matches any character (except for line terminators)
Negative Lookahead
(?!\1)
Assert that the Regex below does not match
\1 matches the same text as most recently matched by the 1st capturing group
Negative Lookahead
(?!\2)
Assert that the Regex below does not match
\2 matches the same text as most recently matched by the 2nd capturing group
3rd Capturing Group
(.)
. matches any character (except for line terminators)
\2 matches the same text as most recently matched by the 2nd capturing group
Negative Lookahead
(?!\1)
Assert that the Regex below does not match
Negative Lookahead
(?!\2)
Assert that the Regex below does not match
Negative Lookahead
(?!\3)
Assert that the Regex below does not match
. matches any character (except for line terminators)
\2 matches the same text as most recently matched by the 2nd capturing group
\1 matches the same text as most recently matched by the 1st capturing group
$ asserts position at the end of a line
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)
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
gm

Test String