Page 1 of 1

closing tags from opening tags using regex

Posted: Sun Sep 07, 2008 2:43 am
by PHPycho
Hello forums !!
I would like to know the closing tags for following strings using php

Code: Select all

$opening = '<div class="xxy">
<ul id="aab">
<li>';
$closing  = ? //should be </li></ul></div>
How to accomplish this using regular expression, any ideas ??

Re: closing tags from opening tags using regex

Posted: Sun Sep 07, 2008 8:06 am
by markusn00b
Why use a regular expression? Can't you just close them like normal? :dubious:

Re: closing tags from opening tags using regex

Posted: Sun Sep 07, 2008 11:21 am
by Cut
Use regular expressions to recognize <b>$1</b> and just escape <b> alone.

Re: closing tags from opening tags using regex

Posted: Mon Sep 08, 2008 12:58 am
by josh
http://tidy.sourceforge.net/
opensource project for fixing HTML documents