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
"
construit en (lieu|plusieurs|parpaings|face|forme|immeuble|(\d+|\w{2,10}) ([ée]tapes|phases)|ossature|siporex|plaques|charpente|rez.*|rdc|cloison|\d+ fois|r\+\d+)
"
gm
construit en
matches the characters construit en literally (case sensitive)
1st Capturing Group
(lieu|plusieurs|parpaings|face|forme|immeuble|(\d+|\w{2,10}) ([ée]tapes|phases)|ossature|siporex|plaques|charpente|rez.*|rdc|cloison|\d+ fois|r\+\d+)
1st Alternative
lieu
lieu
matches the characters lieu literally (case sensitive)
2nd Alternative
plusieurs
plusieurs
matches the characters plusieurs literally (case sensitive)
3rd Alternative
parpaings
parpaings
matches the characters parpaings literally (case sensitive)
4th Alternative
face
face
matches the characters face literally (case sensitive)
5th Alternative
forme
forme
matches the characters forme literally (case sensitive)
6th Alternative
immeuble
immeuble
matches the characters immeuble literally (case sensitive)
7th Alternative
(\d+|\w{2,10}) ([ée]tapes|phases)
2nd Capturing Group
(\d+|\w{2,10})
1st Alternative
\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)
2nd Alternative
\w{2,10}
\w
matches any word character (equivalent to [a-zA-Z0-9_])
{2,10} matches the previous token between 2 and 10 times, as many times as possible, giving back as needed (greedy)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
3rd Capturing Group
([ée]tapes|phases)
1st Alternative
[ée]tapes
Match a single character present in the list below
[ée]
ée
matches a single character in the list ée (case sensitive)
tapes
matches the characters tapes literally (case sensitive)
2nd Alternative
phases
phases
matches the characters phases literally (case sensitive)
8th Alternative
ossature
ossature
matches the characters ossature literally (case sensitive)
9th Alternative
siporex
siporex
matches the characters siporex literally (case sensitive)
10th Alternative
plaques
plaques
matches the characters plaques literally (case sensitive)
11th Alternative
charpente
12th Alternative
rez.*
13th Alternative
rdc
14th Alternative
cloison
15th Alternative
\d+ fois
16th Alternative
r\+\d+
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)
Your regular expression does not match the subject string.

Regular Expression
No Match

r"
"
gm

Test String