Closed Thread Icon

Topic awaiting preservation: preg_replace doesn't replace (Page 1 of 1) Pages that link to <a href="" title="Pages that link to Topic awaiting preservation: preg_replace doesn&amp;#039;t replace (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: preg_replace doesn&#039;t replace <span class="small">(Page 1 of 1)</span>\

Paranoid (IV) Inmate

Insane since: Apr 2000

posted posted 10-22-2004 22:55

I've got a page with a bunch of preg_replace calls (I'm doing a web scraping project). All of them work except for this one:

$code = preg_replace("(<b>Printer-Friendly Versions \(pdf & html\) of this Section<\/b>&nbsp;<font color=\"black\">- all combined into one document<\/a><\/small><br>)si","", $code);

The code I'm trying to pull out is:

<b>Printer-Friendly Versions (pdf & html) of this Section</b>&nbsp;<font color="black">- all combined into one document</font></a></small><br>


I don't get an error. It just doesn't remove it. I've tried escaping just about everything I thought might be causing the problem, to no avail.


Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 10-23-2004 02:09

There's no closing font tag in the preg

.:[ Never resist a perfect moment ]:.

Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 10-23-2004 10:14

yep, bit nailed it. SInce there' no closing font tag the preg_replace can't find the specific string. It don't exist cobber. Silly mistake, I know, but we all have them, and it seems the longer you examine your code the less likely it is you'll find it. Believe me. I once spent 4 hours searching a piece of Java code for an error, only to find I'd entered 'BuggeredReader' instead of 'BufferedReader'. I only found it after I went to bed, slept and came back to it the next morning.

« BackwardsOnwards »

Show Forum Drop Down Menu