You are here: Re: Parsing HTML with Regular Expressions « HTML « IT news, forums, messages
Re: Parsing HTML with Regular Expressions

Posted by Gunnar Hjalmarsson on 06/15/05 19:34

Captain Dondo wrote:
> I am trying to pull out an href from a bit of javascript. I am running
> php, but the RE should be the same....

Are you sure of that?

> What I want to do is pull out the URL in the window.open call but only
> if it doesn't contain either a next=[whatever] or a prev=[whatever] tag.

<snip>

> The RE I am using is
>
> $re = '<[aA] .*image=([a-zA-Z0-9.:/-]*).*/>';

This may or may not do what you want:

$re = '<[aA][^>]+image=([a-zA-Z0-9.:/-]+)(?![^>]+(?:next|prev)=)';

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация