Hi,

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>
===
My latest, yet clearly erroneous, attempt is:
===
$page =~m|<noframes>(?:.*?)<a href(?:\s?)=(?:\s?)"(http://(?:.*?)[^net +scape\.com|^microsoft\.com](?:.*?))"|is; $url_containing_neither_value = $1;
===
I would appreciate any help you can provide.

Thank you. :)


In reply to Question Regarding Regular Expressions and Negated Character Classes by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.