- Save Regexctrl+s
- Go to library entry

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

- Match
- Substitution
- List
- Unit Tests

Sponsor

Jamstack at Scale

/

(?:(^(?:\s*)\/{4,}\n)+(^(\s*)\/{2,3}(?!\/)[\s\S]*\n)*\1)

/

gm

Non-capturing group

(?:(^(?:\s*)\/{4,}\n)+(^(\s*)\/{2,3}(?!\/)[\s\S]*\n)*\1)

1st Capturing Group

(^(?:\s*)\/{4,}\n)+

+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)

A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data

^ asserts position at start of a line

Non-capturing group

(?:\s*)

\s

matches any whitespace character (equivalent to [\r\n\t\f\v ])* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)

\/

matches the character / with index 47{4,} matches the previous token between 4 and unlimited times, as many times as possible, giving back as needed (greedy)

\n matches a line-feed (newline) character (ASCII 10)

2nd Capturing Group

(^(\s*)\/{2,3}(?!\/)[\s\S]*\n)*

* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)

A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data

^ asserts position at start of a line

3rd Capturing Group

(\s*)

\s

matches any whitespace character (equivalent to [\r\n\t\f\v ])* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)

\/

matches the character / with index 47{2,3} matches the previous token between 2 and 3 times, as many times as possible, giving back as needed (greedy)

Negative Lookahead

(?!\/)

Assert that the Regex below does not match

\/ matches the character / with index 47_{10} (2F_{16} or 57_{8}) literally (case sensitive)

Match a single character present in the list below

[\s\S]

* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)

\s matches any whitespace character (equivalent to [\r\n\t\f\v ])

\S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ])

\n matches a line-feed (newline) character (ASCII 10)

\1 matches the same text as most recently matched by the 1st capturing group

Global pattern flags

g modifier: **g**lobal. All matches (don't return after first match)

m modifier: **m**ulti 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.Try launching the debugger to find out why.

/

/

gm

Processing...

Please wait while the app is loading...