Le 19/02/2011 0:23, Tommy Pham a écrit :
@Simon,
Thanks for explaining about the [^href]. I need to read up more about
greediness. I thought I understood it but guess not.
@Peter,
I tried your pattern but it didn't capture all of my new test cases.
Also, it captures the single/double quotes
@Simon,
Thanks for explaining about the [^href]. I need to read up more about
greediness. I thought I understood it but guess not.
@Peter,
I tried your pattern but it didn't capture all of my new test cases.
Also, it captures the single/double quotes in addition to the
fragments inside the hre
On 18 February 2011 22:36, Tommy Pham wrote:
> Hi folks,
>
> This is not directly relating to PHP but it's Friday so I'm gonna give
> it a shot :). Would someone please help me figure out why my regex
> pattern doesn't work. Below is the code and sample data:
>
> $html = << href="http://images.
As far as I can tell, your problem lies in [^href]*. That will match any
characters other than h, r, e or f, not anything other than the string href.
Consider replacing it with [^>]*?. The ? makes it non-greedy so it will stop as
soon as it can (when it matches the first href) rather than as lat
4 matches
Mail list logo