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
/
^(?:lundi|mardi|mercredi|jeudi|vendredi|samedi|dimanche) [0-3]?[0-9] (?:janvier|f[eé]vrier|mars|avril|mai|juin|juillet|ao[uû]t|septembre|octobre|novembre|d[eé]cembre) [0-9]{4} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$
/
i
^ asserts position at start of the string
Non-capturing group
(?:lundi|mardi|mercredi|jeudi|vendredi|samedi|dimanche)
1st Alternative
lundi
lundi
matches the characters lundi literally (case insensitive)
2nd Alternative
mardi
mardi
matches the characters mardi literally (case insensitive)
3rd Alternative
mercredi
mercredi
matches the characters mercredi literally (case insensitive)
4th Alternative
jeudi
jeudi
matches the characters jeudi literally (case insensitive)
5th Alternative
vendredi
vendredi
matches the characters vendredi literally (case insensitive)
6th Alternative
samedi
samedi
matches the characters samedi literally (case insensitive)
7th Alternative
dimanche
dimanche
matches the characters dimanche literally (case insensitive)
matches the character with index 3210 (2016 or 408) literally (case insensitive)
Match a single character present in the list below
[0-3]
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
0-3 matches a single character in the range between 0 (index 48) and 3 (index 51) (case insensitive)
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 insensitive)
matches the character with index 3210 (2016 or 408) literally (case insensitive)
Non-capturing group
(?:janvier|f[eé]vrier|mars|avril|mai|juin|juillet|ao[uû]t|septembre|octobre|novembre|d[eé]cembre)
1st Alternative
janvier
janvier
matches the characters janvier literally (case insensitive)
2nd Alternative
f[eé]vrier
f matches the character f with index 10210 (6616 or 1468) literally (case insensitive)
Match a single character present in the list below
[eé]
eé
matches a single character in the list eé (case insensitive)
vrier
matches the characters vrier literally (case insensitive)
3rd Alternative
mars
mars
matches the characters mars literally (case insensitive)
4th Alternative
avril
avril
matches the characters avril literally (case insensitive)
5th Alternative
mai
mai
matches the characters mai literally (case insensitive)
6th Alternative
juin
juin
matches the characters juin literally (case insensitive)
7th Alternative
juillet
juillet
matches the characters juillet literally (case insensitive)
8th Alternative
ao[uû]t
ao
matches the characters ao literally (case insensitive)
Match a single character present in the list below
[uû]
t matches the character t with index 11610 (7416 or 1648) literally (case insensitive)
9th Alternative
septembre
10th Alternative
octobre
11th Alternative
novembre
12th Alternative
d[eé]cembre
matches the character with index 3210 (2016 or 408) literally (case insensitive)
Match a single character present in the list below
[0-9]
{4} matches the previous token exactly 4 times
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case insensitive)
matches the character with index 3210 (2016 or 408) literally (case insensitive)
Match a single character present in the list below
[0-9]
{1,2} matches the previous token between 1 and 2 times, as many times as possible, giving back as needed (greedy)
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case insensitive)
: matches the character : with index 5810 (3A16 or 728) literally (case insensitive)
Match a single character present in the list below
[0-9]
{1,2} matches the previous token between 1 and 2 times, as many times as possible, giving back as needed (greedy)
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case insensitive)
: matches the character : with index 5810 (3A16 or 728) literally (case insensitive)
Match a single character present in the list below
[0-9]
{1,2} matches the previous token between 1 and 2 times, as many times as possible, giving back as needed (greedy)
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case insensitive)
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
Global pattern flags
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

/
/
i

Test String