Monks

I'm using ProxyRemoteMatch directive in mod_proxy, and the httpd docs say that Apache's regular expression library is a subset of Perls. I am trying to generate a regular expression to not match a set of words, i.e. not match any expressions that represent images such as "foo.jpg" or "bar.gif".

Normally, I would use negative match with alternation such as !~ m/(some|words)/;, but I can't do that here. My latest attempt has used a zero-width negative lookbehind assertion:

\w+\.(?!gif)(?!jpe?g)$
to not match any urls ending in .gif or .jpe|g that were followed by "imagename" (\w+ in the regex). I've been through the perlre man page, perlretut, but I need to ask for help at this point. I don't know the extent of the subset of Perl's regex engine that is implemented in Apache, but any suggestions here on alternative regex formulations would be most appreciated.


In reply to Negative expressions with alternation in ProxyRemoteMatch by redhotpenguin

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.