Temporary backslashes in front of quotes during string comparisons?? Very strange problem

From: Dakos San (no.spam_at_thanks.com)
Date: 04/27/04


Date: Tue, 27 Apr 2004 16:23:44 +0100

Hi,

I'm trying to write a function to search a body of text for external html
image links but I'm running into a really strange problem. All the double
quotes appear to have a backslash (ASCII 92) in front of them during the
comparison - but NOT when they print out.

The text has been submitted via a HTML form.

For example this regex:

    <img[^>]*src=.http[^>]*>

does not find this html in the search string when running from my php script
(eregi or preg_match) It works on the same body of text in EditPad though!:

   <img src="http://www.nowhere.com/image.jpg">

Whereas if I change the regex to:

    <img[^>]*src=.{2}http[^>]*>

It works in PHP but not anywhere else.. - by allowing for 2 characters where
I *know* there is only one ", it finds what it's meant to find.

The "extra" character shows up as ascii 92 if I use ord(), but it does NOT
print as anything. (That's a backslash ASCII)

I know I'm a noob to Regex but what on earth could be going on??



Relevant Pages