Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I realise this is an incredibly basic question, but after reading the relevant man pages, chapters from Perl books, and hours of experimenting, I still can't work out the answer... I want to write a regex that will search a multi-line string -- starting with '<noframes>' and ending with '</noframes>' -- for hypertext links that do not include either 'netscape.com' or 'microsoft.com' anywhere in the URL portion. I then want to extract this URL using the standard $<integer_here> method. The match should be case-insensitive.
Sample input (value of $page) is:
===
===<noframes> <a HREF="http://www.microsoft.com/browser"> <A href ="http://perlmonks +.com/" </noframes>
===$page =~m|<noframes>(?:.*?)<a href(?:\s?)=(?:\s?)"(http://(?:.*?)[^net +scape\.com|^microsoft\.com](?:.*?))"|is; $url_containing_neither_value = $1;
Thank you. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question Regarding Regular Expressions and Negated Character Classes
by thpfft (Chaplain) on Jul 14, 2002 at 17:43 UTC | |
by Anonymous Monk on Jul 14, 2002 at 17:50 UTC | |
by thpfft (Chaplain) on Jul 14, 2002 at 18:59 UTC | |
|
Re: Question Regarding Regular Expressions and Negated Character Classes
by flocto (Pilgrim) on Jul 15, 2002 at 07:24 UTC |