Regular Expressions 101

Save & Share

  • Save Regex
    ctrl+s
  • Update Regex
    ctrl+⇧+s

Flavor

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

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
(?<=(;\d{4}-\d\d-\d\d\n))((?:[^;]++|;)*?)\1
/
g
Positive Lookbehind
(?<=(;\d{4}-\d\d-\d\d\n))
Assert that the Regex below matches
1st Capturing Group
(;\d{4}-\d\d-\d\d\n)
; matches the character ; with index 5910 (3B16 or 738) literally (case sensitive)
\d
matches a digit (equivalent to [0-9])
{4} matches the previous token exactly 4 times
- matches the character - with index 4510 (2D16 or 558) literally (case sensitive)
\d matches a digit (equivalent to [0-9])
\d matches a digit (equivalent to [0-9])
- matches the character - with index 4510 (2D16 or 558) literally (case sensitive)
\d matches a digit (equivalent to [0-9])
\d matches a digit (equivalent to [0-9])
\n matches a line-feed (newline) character (ASCII 10)
2nd Capturing Group
((?:[^;]++|;)*?)
Non-capturing group
(?:[^;]++|;)*?
*? matches the previous token between zero and unlimited times, as few times as possible, expanding as needed (lazy)
1st Alternative
[^;]++
Match a single character not present in the list below
[^;]
++ matches the previous token between one and unlimited times, as many times as possible, without giving back (possessive)
; matches the character ; with index 5910 (3B16 or 738) literally (case sensitive)
2nd Alternative
;
; matches the character ; with index 5910 (3B16 or 738) literally (case sensitive)
\1 matches the same text as most recently matched by the 1st capturing group
Global pattern flags
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
g

Test String

Substitution

Processing...