RE: [PHP] Regular expression help converting doc to xml
| From: | John Holmes | Date: | Fri, 27 Sep 2002 21:53:34 +0000 |
| Subject: | RE: [PHP] Regular expression help converting doc to xml | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117898@lists.php.net to get a copy of this message | ||
> I have a fairly large html document that I need to convert to xml.
> The current format is is:
> <DD> A whole bunch of text
> <DT> Something else </DT>
> (There is a new line in there before <DT>)
>
> Which I need to convert to
> <DD> A whole bunch of text </DD>
> <DT> Something else </DT>
$new_text =
str_replace("\n\t<DT>","</DD>\n\t<DT>",$your_text);
Assuming there is a tab in there...
You'd be better off getting an editor that'll do this for you. Textpad
lets you search and replace with regular expressions. Other programs do
too.
---John Holmes...