Regular Expressions 101

Community Patterns

Save everything between <code>...</code> brackets

1

Regular Expression
PCRE (PHP <7.3)

/
(?<=<code>).+?(?=<\/code>)
/
gm

Description

This is what I created to paste in web page source code and regex to extract content between whichever HTML brackets that I choose..

In this case, it's the <code> HTML brackets.

Submitted by https://dug.to - 2 years ago