and [/b] with $highlightedText = str_replace('[b]', '', $highlightedText); $highlightedText = str_replace('[/b]', '', $highlightedText); } ?> Test regular expressions

Test PHP Regular Expression Functions (Perl-Compatible)

preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER)

Enter your regular expression ($pattern):

Enter text to search against in the textarea below ($subject):

Home


$escapedRegexp matched!\n

"; echo "

Here's what was matched searching the text you entered:

\n"; $y = 0; echo '
'; foreach ($results as $loop_result) { $x = 0; foreach ($loop_result as $loop_result2){ if ($x != 0) { /* Indent subpatterns. */ echo "
"; } printf('$matches[%s][%s]:  ', $y, $x);// show variable name if (!$loop_result2){ echo 'Empty'; } else { echo '' . htmlentities($loop_result2) . ''; } if ($x != 0) { echo "
"; } else { echo "

"; } $x++; } $y++; } echo '

'; } else { // no match echo "regexp $escapedRegexp doesn't return any results\n

"; } ?>

Searched text with matches highlighted

'; echo $highlightedText; echo '
'; } ?>

Example regular expressions:

{<!--(?:.|\s)*?-->}  --  Shows comments in html 

{<style type(?:.|\s)*?</style>} -- Shows styles

Notes: