Regular Expressions 101

Save & Share

Flavor

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

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
the.100.S01E\d{1,2}.*720p.*hun.eng.*sln|the.100.S\d{1,2}.*720p.*hun.eng.*sln
/
gmi
1st Alternative
the.100.S01E\d{1,2}.*720p.*hun.eng.*sln
the
matches the characters the literally (case insensitive)
. matches any character (except for line terminators)
100
matches the characters 100 literally (case insensitive)
. matches any character (except for line terminators)
S01E
matches the characters S01E literally (case insensitive)
\d
matches a digit (equivalent to [0-9])
{1,2} matches the previous token between 1 and 2 times, as many times as possible, giving back as needed (greedy)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
720p
matches the characters 720p literally (case insensitive)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
hun
matches the characters hun literally (case insensitive)
. matches any character (except for line terminators)
eng
matches the characters eng literally (case insensitive)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
sln
matches the characters sln literally (case insensitive)
2nd Alternative
the.100.S\d{1,2}.*720p.*hun.eng.*sln
the
matches the characters the literally (case insensitive)
. matches any character (except for line terminators)
100
matches the characters 100 literally (case insensitive)
. matches any character (except for line terminators)
S matches the character S with index 8310 (5316 or 1238) literally (case insensitive)
\d
matches a digit (equivalent to [0-9])
{1,2} matches the previous token between 1 and 2 times, as many times as possible, giving back as needed (greedy)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
720p
matches the characters 720p literally (case insensitive)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
hun
matches the characters hun literally (case insensitive)
. matches any character (except for line terminators)
eng
matches the characters eng literally (case insensitive)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
sln
matches the characters sln literally (case insensitive)
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)
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
gmi

Test String