Hi all,
I am trying to build a regex to check if an array of allowed html tags
were closed. For example:
Wrong:
<b>text</a>
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
closed
<?php
}
}
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
:-)
Thanks,
--
Julio Nobrega.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php