Development RegEx: anything but "x"?

Discussion in 'Tech Support' started by jezmck, 9 Oct 2009.

  1. jezmck

    jezmck Minimodder

    Joined:
    25 Sep 2003
    Posts:
    4,456
    Likes Received:
    36
    Hi guys and gals,

    I'm trying to create a rule used in a .htaccess file to match anything but a particular string

    It should be possible to match this special string first and use [L] but that's not working, and it should be possible using the following regex, but it causes a 500 error.

    I want to match:
    • pagename1
    • pagename2/whatever
    • contact-us
    • (etc)

    but not
    • index/123/whatever

    (BTW "index" is the name of a file with no extension, not my choice, this is a work thing)

    Code:
    ^(?!index)[\w/\-]+
    I assume that apache's implementation of regex doesn't cope with the (?!xxx) rule.

    NB, I'm using http://regexpal.com/ for testing the theory.



    Any help/suggestions will be much appreciated.
     

Share This Page