Thread: Regex for url

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    1
    Rep Power
    0

    Regex for url


    I have an existing regex for urls:
    ^([^/]+)/([^/]+)/([^/]+)/?$

    that successfully matches urls like:
    http://localhost/the-x-family/media/12139
    http://localhost/the-x-family/video/6547
    http://localhost/community/support/forum.aspx

    I don't want it to match anything with ".aspx". How can I exclude that string?

    Thanks!
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,961
    Rep Power
    9397
    Try
    Code:
    ^([^/]+)/([^/]+)/([^/]+)/?(?<!\.aspx)$

IMN logo majestic logo threadwatch logo seochat tools logo