RE: [PHP] Quotes in regular expressions

2003-08-21 Thread Ford, Mike [LSS]
On 21 August 2003 17:03, Thaddeus J. Quintin wrote: Lets say I'm trying to extract some data from an HTML document. I want to get the values of the 'src' attributes of various tags. For example- img src=http://www.yahoo.com; here's the pattern I've been trying-

Re: [PHP] Quotes in regular expressions

2003-08-21 Thread Thaddeus J. Quintin
-- SNIP -- If single-quoting (better, if you don't variable interpolation) you don't even need to escape the backslashes, so: $pattern = '/\bsrc=([\'|])[^\1]*[\1]/im'; -- SNIP -- nope, not quite... Here's what I've got- $pattern='/\bsrc=([\'|])([^\1])*[\1]/im'; the string that's coming

Re: [PHP] Quotes in regular expressions

2003-08-21 Thread Scott Fletcher
Try parsing it as a string where the double quote would become a string. See if that help. (Parse the whole characters into strings then find the double quote.) Thaddeus J. Quintin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- SNIP -- If single-quoting (better, if you don't

Re: [PHP] Quotes in regular expressions

2003-08-21 Thread Thaddeus J. Quintin
The biggest part of my problem was that I had already called htmlspecialchars on the string, so there was no quotes to match! Duh. Even after I fixed that it was still turning into a hassle, so I just made two checks, one for single quotes, and, failing that, one for double quotes. not the

Re: [PHP] Quotes in regular expressions

2003-08-21 Thread Scott Fletcher
That may be why! It's the htmlspecialchars() that is the issue.. The signle quote get convert into this, not sure if this apply to your situation though. --snip-- Reference : Special Characters in HTML left single quote lsquo; ' right single quote rsquo; ' --snip-- Thaddeus