Hi all,

  I am trying to build a regex to check if an array of allowed html tags
were closed. For example:

  Should give me something like: Tag <b> was not closed.

  Here's what I came up so far:

$tags_to_check = Array('a','b','i','p');
foreach ($tags_to_check as $tag_check) {
    if (eregi("<". $tag_check . ">(.*)[^</" . $tag_check .
">]",$_POST['form_field'])) {
        ?> Tag <?php echo htmlentities('<' . $tag_check . '>'); ?> not

  I know there's some optimization that also could be done regarding the
foreach loop, but I haven't come up with any solutions.

  Any help is appreciated, since I promised to myself to learn regex tonight


Julio Nobrega.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to