jwhite68 Posted September 27, 2007 Share Posted September 27, 2007 I want to find a way, whereby I can detect any occurence of a text string in a variable (lets say $desc), that occurs immediately after a </UL> and insert a start and end <P></P> around that text string (immediately after the </UL>. Can anyone advise how I could achieve this using something like preg_replace? eg. If the source text is: This is a test. <br /> Heres a car. <br /> <UL><br /> <LI>Point 1<br /> <LI>Point 2<br /> <LI>Point 3</LI></UL>This is my text string. So I want the output to be: This is a test. <br /> Heres a car. <br /> <UL><br /> <LI>Point 1<br /> <LI>Point 2<br /> <LI>Point 3</LI></UL><P>This is my text string.</P> But it needs to make this change wherever it finds this occurence of a text string after a </UL>. Link to comment https://forums.phpfreaks.com/topic/70863-php-advice-for-search-and-replace/ Share on other sites More sharing options...
jwhite68 Posted September 27, 2007 Author Share Posted September 27, 2007 Oh, and if it detects a BR tag (with and without /) after the </UL> it should ignore, and still spot the text string afterwards. Link to comment https://forums.phpfreaks.com/topic/70863-php-advice-for-search-and-replace/#findComment-356238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.