Regular Expressions 101

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

Flavor

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

• Match
• Substitution
• List
• Unit Tests

Tools

/
^\[\d{4}\/\d{2}\/\d{2}[^\]]*](.*?)(?=^\[\d{4}\/\d{2}\/\d{2}[^\]]*])|^\[\d{4}\/\d{2}\/\d{2}[^\]]*](.*?)(?!.)
/
gms
1st Alternative
^\[\d{4}\/\d{2}\/\d{2}[^\]]*](.*?)(?=^\[\d{4}\/\d{2}\/\d{2}[^\]]*])
^ asserts position at start of a line
\[ matches the character [ literally (case sensitive)
\d
matches a digit (equivalent to [0-9])
{4} matches the previous token exactly 4 times
\/ matches the character / literally (case sensitive)
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
\/ matches the character / literally (case sensitive)
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
Match a single character not present in the list below
[^\]]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\] matches the character ] literally (case sensitive)
] matches the character ] literally (case sensitive)
1st Capturing Group
(.*?)
(?=^\[\d{4}\/\d{2}\/\d{2}[^\]]*])
Assert that the Regex below matches
2nd Alternative
^\[\d{4}\/\d{2}\/\d{2}[^\]]*](.*?)(?!.)
^ asserts position at start of a line
\[ matches the character [ literally (case sensitive)
\d
matches a digit (equivalent to [0-9])
{4} matches the previous token exactly 4 times
\/ matches the character / literally (case sensitive)
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
\/ matches the character / literally (case sensitive)
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
Match a single character not present in the list below
[^\]]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\] matches the character ] literally (case sensitive)
] matches the character ] literally (case sensitive)
2nd Capturing Group
(.*?)
(?!.)
Assert that the Regex below does not match
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)
s modifier: single line. Dot matches newline characters
Your regular expression does not match the subject string.Try launching the debugger to find out why.

/
/
gms