Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9153855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:20:26+00:00 2026-06-17T12:20:26+00:00

I have a regex defined follow to match http urls , anyone can help

  • 0

I have a regex defined follow to match http urls, anyone can help to explain in English?

^/foo/.*(?<!\.css|\.js|\.jpg)$
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:20:27+00:00Added an answer on June 17, 2026 at 12:20 pm

    Any file or directory in directory /foo or below that is not css, js or jpg file.

    ^        start of string anchor
    /foo/    literal "/foo/"
    .*       any number of characters
    (?<!...) match from here backwards must fail:
      \.     dot
      css    literal "css"
      |      or
    $        end of string anchor
    

    So, start of string, /foo/, maybe some other characters, then string ends – but just before, can’t be .css, .js or .jpg.

    EDIT: Apologies for being stubborn. It is indeed an invalid regular expression for most engines, including Perl. The reason is, negative lookbehind must have fixed width; and this lookbehind can be either four characters (in case of .jpg or .css) or three characters (.js). A fix is to insert an additional “match anything” into the lookbehind so that the width is always four:

    ^/foo/.*(?<!\.css|.\.js|\.jpg)$
    

    With that, it works:

    perl -e 'print "/foo/bar" =~ m[^/foo/.*(?<!\.css|.\.js|\.jpg)$];'
    => 1
    

    OP: Your problem with regexpal.com is the fact that they test for JavaScript regular expressions, which do not implement negative lookbehind at all. Regexp dialects differ in details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this regex that detects hashtags. It shouldn't match things with letters before
I currently have a list of defined constants and a function that regex'es every
I have a regex pattern defined as var pattern = ,(?=(?:[^\]*\[^\]*\)*(?![^\]*\)); and I am
I have a dictionary defined as Dictionary<int, Regex> . There are a number of
I have a number of user defined Regex es that I'm using to test
I have an old perl regex defined like this my @data = split(/^[0-9]{1,3}\)?\t/m, $CLIP->GetText());
This seems to match the rules I have defined, but I only starting learning
I have a regex where %word% can occur multiple times, separated by a <
I am rejigging some urls that have been defined in javascript: var x =
I have regex patterns in PHP $s = preg_replace(#\[URL\=(.*)\](.*)\[\/URL\]#Ui, <a href=\$1\ target=\_blank\>$2</a>, $s); $s

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.