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
/
(?P<id>\d+)_(?<version>v\d+)_(?P<description>\S+)_(?P<quality>(?i)Q4A|Q6A|Q8C|QXB).(?<extension>(?i)mp4|webm)
/
g
Named Capture Group id
(?P<id>\d+)
\d
matches a digit (equivalent to [0-9])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
_ matches the character _ with index 9510 (5F16 or 1378) literally (case sensitive)
Named Capture Group version
(?<version>v\d+)
v matches the character v with index 11810 (7616 or 1668) literally (case sensitive)
\d
matches a digit (equivalent to [0-9])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
_ matches the character _ with index 9510 (5F16 or 1378) literally (case sensitive)
Named Capture Group description
(?P<description>\S+)
\S
matches any non-whitespace character (equivalent to [^\r\n\t\f\v ])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
_ matches the character _ with index 9510 (5F16 or 1378) literally (case sensitive)
Named Capture Group quality
(?P<quality>(?i)Q4A|Q6A|Q8C|QXB)
1st Alternative
(?i)Q4A
(?i)
match the remainder of the pattern with the following effective flags: gi
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
Q4A
matches the characters Q4A literally (case insensitive)
2nd Alternative
Q6A
Q6A
matches the characters Q6A literally (case insensitive)
3rd Alternative
Q8C
Q8C
matches the characters Q8C literally (case insensitive)
4th Alternative
QXB
QXB
matches the characters QXB literally (case insensitive)
. matches any character (except for line terminators)
Named Capture Group extension
(?<extension>(?i)mp4|webm)
1st Alternative
(?i)mp4
(?i)
match the remainder of the pattern with the following effective flags: gi
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
mp4
matches the characters mp4 literally (case insensitive)
2nd Alternative
webm
webm
matches the characters webm literally (case insensitive)
Global pattern flags
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
g

Test String