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

  • Home
  • SEARCH
  • 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 5980693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:50:15+00:00 2026-05-22T21:50:15+00:00

each part of this regex works alone but when i string them together it

  • 0

each part of this regex works alone but when i string them together it does not match a url with http or www followed by one of the listed TLDs.

(preg_match('/http\:\/\/(www\.)?[a-z](\.com|\.org|\.net|\.mil|\.edu|\.COM|\.ORG|\.NET|\.MIL|\.EDU)$/', $bandUrl))

  • 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-05-22T21:50:15+00:00Added an answer on May 22, 2026 at 9:50 pm

    You probably left out the + after [a-z] (which btw is not correct to match all valid URLs). And instead of listing both uppercase and lowercase .TLDs, you could use the /i flag:

    preg_match('/http\:\/\/(www\.)?[a-z]+(\.com|\.org|\.net|\.mil|\.edu$/i',
    

    Btw, as alternative you could use filter_var($url, FILTER_VALIDATE_URL) for testing.

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

Sidebar

Related Questions

I have this part of the function : $jQ('.product-collateral .product-tabs li').each(function(index){ $jQ(this).attr('id', $jQ(this).find('h3').attr('class')); if(index
I have a string s that I want to split up so each part
I have three divs stacked on each other but offset so that a part
I have this link: http://mysite.com/subdirectory/something/stuff/index.php What regex would I be able to use that
I'm not even sure if this is possible or not, but here's what I'd
I guess this is more or less a two-part question, but here's the basics
I have part objects and material objects. Each part has at most 1 material
So im stuck on a few things in each part below, they are pretty
I'm trying to produce a report that shows, for each Part No, the results
I want to divide the window into 2 parts. Each part I can draw

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.