Posted by Gunnar Hjalmarsson on 06/16/05 00:49
Captain Dondo wrote:
> Gunnar Hjalmarsson wrote:
>> Captain Dondo wrote:
>>> I am running php, but the RE should be the same....
>>
>> Are you sure of that?
>
> Hopefully close enough to get me started....
>
>> $re = '<[aA][^>]+image=([a-zA-Z0-9.:/-]+)(?![^>]+(?:next|prev)=)';
>
> Close enough.... It's picking up the whole <a ... /a>
In Perl it does its job on the example snippets you posted. That's what
I meant when questioning that regular expressions are the same
irrespective of the programming language. You'd better not count on it.
> but I think it's enough to get me started....
The (?!...) construct is called a "zero-width negative look-ahead
assertion" in Perl.
> The [^>] rewinds the pattern match to the beginning of the line, I take it?
No. Jim explained what it means (and *that* is not Perl specific AFAIK).
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
[Back to original message]
|