Regular Expressions 101

Community Library Entry

-1

Regular Expression
PCRE (PHP <7.3)

/
<([A-Za-z]{1,7}) .*class='([a-zA-Z0-9_ ]{0,})searchedclass[ '].*>.*<\/\1.*>
/
iUs

Description

The regex finds for example the <td class='searchedclass'>random text</td> sequence, if ohne single quotes ar used. The td itself may vary (td, div, span, p and so on), the provided class ist the item searched vor.

Submitted by xm318 - 9 years ago