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
"
(0?[1-9]|1[0-2]) \/ (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \/ (1|2)[0-9]{3} \s ((0|1)[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])
"
x
1st Capturing Group
(0?[1-9]|1[0-2])
1st Alternative
0?[1-9]
0
matches the character 0 with index 4810 (3016 or 608) literally (case sensitive)
Match a single character present in the list below
[1-9]
1-9 matches a single character in the range between 1 (index 49) and 9 (index 57) (case sensitive)
2nd Alternative
1[0-2]
1 matches the character 1 with index 4910 (3116 or 618) literally (case sensitive)
Match a single character present in the list below
[0-2]
0-2 matches a single character in the range between 0 (index 48) and 2 (index 50) (case sensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case sensitive)
Non-capturing group
(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
1st Alternative
Jan
Jan
matches the characters Jan literally (case sensitive)
2nd Alternative
Feb
Feb
matches the characters Feb literally (case sensitive)
3rd Alternative
Mar
Mar
matches the characters Mar literally (case sensitive)
4th Alternative
Apr
Apr
matches the characters Apr literally (case sensitive)
5th Alternative
May
May
matches the characters May literally (case sensitive)
6th Alternative
Jun
Jun
matches the characters Jun literally (case sensitive)
7th Alternative
Jul
Jul
matches the characters Jul literally (case sensitive)
8th Alternative
Aug
Aug
matches the characters Aug literally (case sensitive)
9th Alternative
Sep
Sep
matches the characters Sep literally (case sensitive)
10th Alternative
Oct
Oct
matches the characters Oct literally (case sensitive)
11th Alternative
Nov
12th Alternative
Dec
\/ matches the character / with index 4710 (2F16 or 578) literally (case sensitive)
2nd Capturing Group
(1|2)
1st Alternative
1
1 matches the character 1 with index 4910 (3116 or 618) literally (case sensitive)
2nd Alternative
2
2 matches the character 2 with index 5010 (3216 or 628) literally (case sensitive)
Match a single character present in the list below
[0-9]
{3} matches the previous token exactly 3 times
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
\s matches any whitespace character (equivalent to [\r\n\t\f\v  ])
3rd Capturing Group
((0|1)[0-9]|2[0-3])
1st Alternative
(0|1)[0-9]
4th Capturing Group
(0|1)
1st Alternative
0
0 matches the character 0 with index 4810 (3016 or 608) literally (case sensitive)
2nd Alternative
1
1 matches the character 1 with index 4910 (3116 or 618) literally (case sensitive)
Match a single character present in the list below
[0-9]
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
2nd Alternative
2[0-3]
2 matches the character 2 with index 5010 (3216 or 628) literally (case sensitive)
Match a single character present in the list below
[0-3]
0-3 matches a single character in the range between 0 (index 48) and 3 (index 51) (case sensitive)
: matches the character : with index 5810 (3A16 or 728) literally (case sensitive)
5th Capturing Group
([0-5][0-9])
Match a single character present in the list below
[0-5]
0-5 matches a single character in the range between 0 (index 48) and 5 (index 53) (case sensitive)
Match a single character present in the list below
[0-9]
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
: matches the character : with index 5810 (3A16 or 728) literally (case sensitive)
6th Capturing Group
([0-5][0-9])
Match a single character present in the list below
[0-5]
0-5 matches a single character in the range between 0 (index 48) and 5 (index 53) (case sensitive)
Match a single character present in the list below
[0-9]
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
Global pattern flags
x modifier: extended. Spaces and text after a # in the pattern are ignored
Your regular expression does not match the subject string.

Regular Expression
No Match

r"
"
x

Test String