Regular Expressions 101

Save & Share

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

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8

Function

  • Match
  • Substitution
  • List
  • Unit Tests
"
[0-9a-fA-F]{2}(?:[:-][0-9a-fA-F]{2}){5}
"
g
Match a single character present in the list below
[0-9a-fA-F]
{2} matches the previous token exactly 2 times
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
a-f matches a single character in the range between a (index 97) and f (index 102) (case sensitive)
A-F matches a single character in the range between A (index 65) and F (index 70) (case sensitive)
Non-capturing group
(?:[:-][0-9a-fA-F]{2}){5}
{5} matches the previous token exactly 5 times
Match a single character present in the list below
[:-]
:-
matches a single character in the list :- (case sensitive)
Match a single character present in the list below
[0-9a-fA-F]
{2} matches the previous token exactly 2 times
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
a-f matches a single character in the range between a (index 97) and f (index 102) (case sensitive)
A-F matches a single character in the range between A (index 65) and F (index 70) (case sensitive)
Global pattern flags
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.

Regular Expression
No Match

r"
"
g

Test String