Topic awaiting preservation: preg_replace doesn't replace |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: 127.0.0.1 |
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: $code = preg_replace("(<b>Printer-Friendly Versions \(pdf & html\) of this Section<\/b> <font color=\"black\">- all combined into one document<\/a><\/small><br>)si","", $code);
code: <b>Printer-Friendly Versions (pdf & html) of this Section</b> <font color="black">- all combined into one document</font></a></small><br> . |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 10-23-2004 02:09
There's no closing font tag in the preg |
Maniac (V) Mad Scientist From: :morF |
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. |