RE: [PHP] Regular expression help converting doc to xml

From: Date: Wed, 02 Oct 2002 12:26:38 +0000
Subject: RE: [PHP] Regular expression help converting doc to xml
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-118587@lists.php.net to get a copy of this message
(For the archives) The RegEx I finally used was this: search: <D>(.*) replace: <DD>\1</DD> I tried this in 3 editors: jEdit, eMacs and BBEdit jEdit interpreted the replace expression as literally "\1" eMacs didn't like the parenthesis in the search string In BBEdit it worked like a charm. Not sure why. Perhaps different implementations of RegEx. Is this true? On Fri, 2002-09-27 at 16:53, John Holmes wrote: > > 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... >

« previous php.general (#118587) next »