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
/
(?i)Rozliczenie[\s\a]*VAT[\s\a]*Netto[\s\a]*Podatek[\s\a]*Brutto[\s\a]*[-]*wg[\s\a]*stawki[\s\a]*(?<StVAT>\d{1,2}.0%)[\s\a]*[\s\S]*Razem[\s]*:[\s]*(?<WartoscNetto>(\d{1,3}\.\d{1,3},\d{2}|\d{1,3},\d{2}))\s*(?<KwotaVAT>(\d{1,3}\.\d{1,3},\d{2}|\d{1,3},\d{2}))\s*(?<WartoscBrutto>(\d{1,3}\.\d{1,3},\d{2}|\d{1,3},\d{2}))[\s\a]*Do\s*Zapłaty\s*:\s*(?<DoZaplaty>\k<WartoscBrutto>)
/
gmu
(?i)
match the remainder of the pattern with the following effective flags: gmui
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
Rozliczenie
matches the characters Rozliczenie literally (case insensitive)
Match a single character present in the list below
[\s\a]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\s matches any kind of invisible character (equivalent to [\p{Z}\h\v])
\a matches the bell character (ASCII 7)
VAT
matches the characters VAT literally (case insensitive)
Match a single character present in the list below
[\s\a]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\s matches any kind of invisible character (equivalent to [\p{Z}\h\v])
\a matches the bell character (ASCII 7)
Netto
matches the characters Netto literally (case insensitive)
Match a single character present in the list below
[\s\a]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\s matches any kind of invisible character (equivalent to [\p{Z}\h\v])
\a matches the bell character (ASCII 7)
Podatek
matches the characters Podatek literally (case insensitive)
Match a single character present in the list below
[\s\a]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\s matches any kind of invisible character (equivalent to [\p{Z}\h\v])
\a matches the bell character (ASCII 7)
Brutto
matches the characters Brutto literally (case insensitive)
Match a single character present in the list below
[\s\a]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\s matches any kind of invisible character (equivalent to [\p{Z}\h\v])
\a matches the bell character (ASCII 7)
Match a single character present in the list below
[-]
wg
matches the characters wg literally (case insensitive)
Match a single character present in the list below
[\s\a]
stawki
matches the characters stawki literally (case insensitive)
Match a single character present in the list below
[\s\a]
Named Capture Group StVAT
(?<StVAT>\d{1,2}.0%)
Match a single character present in the list below
[\s\a]
Match a single character present in the list below
[\s\S]
Razem
matches the characters Razem literally (case insensitive)
Match a single character present in the list below
[\s]
: matches the character : with index 5810 (3A16 or 728) literally (case insensitive)
Match a single character present in the list below
[\s]
Named Capture Group WartoscNetto
(?<WartoscNetto>(\d{1,3}\.\d{1,3},\d{2}|\d{1,3},\d{2}))
\s
matches any kind of invisible character (equivalent to [\p{Z}\h\v])
Named Capture Group KwotaVAT
(?<KwotaVAT>(\d{1,3}\.\d{1,3},\d{2}|\d{1,3},\d{2}))
\s
matches any kind of invisible character (equivalent to [\p{Z}\h\v])
Named Capture Group WartoscBrutto
(?<WartoscBrutto>(\d{1,3}\.\d{1,3},\d{2}|\d{1,3},\d{2}))
Match a single character present in the list below
[\s\a]
Do
matches the characters Do literally (case insensitive)
\s
matches any kind of invisible character (equivalent to [\p{Z}\h\v])
Zapłaty
matches the characters Zapłaty literally (case insensitive)
\s
matches any kind of invisible character (equivalent to [\p{Z}\h\v])
: matches the character : with index 5810 (3A16 or 728) literally (case insensitive)
\s
matches any kind of invisible character (equivalent to [\p{Z}\h\v])
Named Capture Group DoZaplaty
(?<DoZaplaty>\k<WartoscBrutto>)
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)
u modifier: unicode. Pattern strings are treated as UTF-16. Also causes escape sequences to match unicode characters
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
gmu

Test String