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 8168951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:41:40+00:00 2026-06-06T20:41:40+00:00

I need a regular expression that would let me validate Url. I found this

  • 0

I need a regular expression that would let me validate Url. I found this one:

"^(http(?:s)?\:\/\/[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*\.[a-zA-Z]{2,6}(?:\/?|(?:\/[\w\-]+)*)(?:\/?|\/\w+\.[a-zA-Z]{2,4}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$"

But my problem is that besides regular urls, I need to allow .cgi paths, without “http(s)”, like this:

123.45.678.543:30/cgi-bin/blah/blah.cgi

Could you please help me figure out how I could add this to the expression above?
Thanks.

  • 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-06T20:41:42+00:00Added an answer on June 6, 2026 at 8:41 pm

    It does not seem to me that the RegExp you posted is general enough to validate any types of URLs. Have a look at What is the best regular expression to check if a string is a valid URL? (especially @eyelidlessness’s answer) to maybe find more elaborate one.

    The problem with your URL is not that it points to some cgi file. The problem is that it should – at least (in the case you are probably (?) talking about) – be

    http://123.45.678.543:30/cgi-bin/blah/blah.cgi
    

    Besides that the numbers in an IP address can be 255 at maximum.
    Even with these corrections it would still not qualify applying the RegExp you posted, but this is only one more hint to the faultiness of your RegExp.

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

Sidebar

Related Questions

I need a regular expression that should validate decimal point as well as range.
Hi I need a regular expression that'll give me something like this part ./something\,
I need a regular expression that will match this pattern (case doesn't matter): 066B-E77B-CE41-4279
I need to build a regular expression that finds a string of this format:
When given a full URL I need a regular expression that I can use
I need to find a regular expression that would be able to work around
I need a regular expression that would split strings like itemXY where X and
I would need a regular expression that escapes or captures (if not already escaped)
I need a regular expression that will not allow multiple special characters in a
I need a regular expression that will accept well-formed emails in several formats (see

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.