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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:58:14+00:00 2026-06-18T17:58:14+00:00

I just only want to check if that link is Google Maps link For

  • 0

I just only want to check if that link is Google Maps link

For example :

var urls =[
    /// correct urls
    "https://www.google.com/maps",
    "https://www.google.fr/maps",
    "https://google.fr/maps",
    "http://google.fr/maps",
    "https://www.google.de/maps",
    "https://www.google.com/maps?ll=37.0625,-95.677068&spn=45.197878,93.076172&t=h&z=4",
    "https://www.google.de/maps?ll=37.0625,-95.677068&spn=45.197878,93.076172&t=h&z=4",
    "https://www.google.com/maps?ll=37.0625,-95.677068&spn=45.197878,93.076172&t=h&z=4&layer=t&lci=com.panoramio.all,com.google.webcams,weather",
    "https://www.google.com/maps?ll=37.370157,0.615234&spn=45.047033,93.076172&t=m&z=4&layer=t",

    "https://www.google.com/maps?ll=37.0625,-95.677068&spn=45.197878,93.076172&t=h&z=4",
    "https://www.google.de/maps?ll=37.0625,-95.677068&spn=45.197878,93.076172&t=h&z=4",
    "https://www.google.com/maps?ll=37.0625,-95.677068&spn=45.197878,93.076172&t=h&z=4&layer=t&lci=com.panoramio.all,com.google.webcams,weather",
    "https://www.google.com/maps?ll=37.370157,0.615234&spn=45.047033,93.076172&t=m&z=4&layer=t",

    /// error urls
    "https://www.google.com/",
    "https://zzz.google.com/maps",
    "https://www.google.com/+",
    "httpsxyz://www.google.com/maps",
    "http://www.anotherdomain.com/+"
    ];

I’m so bad about Regex and tried to use JavaScript Regex Generator but its still hard for me.

I got only ..

Reg = /^http\:\/\/|https\:\/\/|www\.google$/;

and its fail ! 🙁

But I made a live test for you all : http://jsbin.com/onuyux/1/edit?javascript,live


Edited : 2

After I got help from @joel harkes & @dan1111 so i got regex

/^https?\:\/\/(www\.)?google\.[a-z]+\/maps\b/

This is regex for only google.{TLD}/maps so what about maps.google.{TLD} ?

I just want to validate Google Maps URLs and urls from this way (look at the picture)

enter image description here

If possible I want to validate if address or long-lat is set (using li or q parameter check ?) (not only “maps.google.com” for example..)

Updated list + code :

/// correct urls
"https://www.google.com/maps?ll=37.0625,-95.677068&spn=45.197878,93.076172&t=h&z=4",
"https://www.google.de/maps?ll=37.0625,-95.677068&spn=45.197878,93.076172&t=h&z=4",
"https://www.google.com/maps?ll=37.0625,-95.677068&spn=45.197878,93.076172&t=h&z=4&layer=t&lci=com.panoramio.all,com.google.webcams,weather",
"https://www.google.com/maps?ll=37.370157,0.615234&spn=45.047033,93.076172&t=m&z=4&layer=t",
"https://maps.google.com/maps?q=New+York,+NY,+USA&hl=no&sll=19.808054,-63.720703&sspn=54.337928,93.076172&oq=n&hnear=New+York&t=m&z=10",
"https://www.google.com/maps?q=New+York,+New+York,+USA&hl=no&ll=40.683762,-73.925629&spn=0.708146,1.454315&sll=41.47566,-72.026367&sspn=11.190693,23.269043&oq=new&hnear=New+York&t=m&z=10",

/// error urls
"https://www.google.com/",
"https://zzz.google.com/maps",
"https://www.google.com/+",
"httpsxyz://www.google.com/maps",
"http://www.anotherdomain.com/+",
"http://maps.google.com/",
"http://google.com/maps",
"http://google.de/maps",
"?q=New+York,+New+York,+USA&hl=no&ll=40.683762,-73.925629&spn=0.708146,1.454315&sll=41.47566,-72.026367&sspn=11.190693,23.269043&oq=new&hnear=New+York&t=m&z=10",
"&sll=41.47566,-72.026367&sspn=11.190693,23.269043&oq=new&hnear=New+York&t=m&z=10"

Live test : http://jsbin.com/onuyux/25/edit?javascript,live

  • 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-18T17:58:15+00:00Added an answer on June 18, 2026 at 5:58 pm

    Completing dan1111‘s answer here’s a pattern that will match the specified domains and check if the ll GET variable is set:

    Reg = /^https?\:\/\/(www\.)?google\.[a-z]+\/maps\/?\?([^&]+&)*(ll=-?[0-9]{1,2}\.[0-9]+,-?[0-9]{1,2}\.[0-9]+|q=[^&+])+($|&)/;
    

    I could not test it (jsbin is down) but it should match any url that contains at least one of ll or q parameters.

    EDIT:

    I added the maps. subdomain and fixed a small typo. After q= the + should be outside of the character class, to let it repeat: q=[^&]+ instead of q=[^&+].
    That being said, here’s your regex:

    Reg = /^https?\:\/\/(www\.|maps\.)?google\.[a-z]+\/maps\/?\?([^&]+&)*(ll=-?[0-9]{1,2}\.[0-9]+,-?[0-9]{1,2}\.[0-9]+|q=[^&]+)+($|&)/;
    

    EDIT2:

    To accept the google.co.uk style domains use the following regex.

    Reg = /^https?\:\/\/(www\.|maps\.)?google(\.[a-z]+){1,2}\/maps\/?\?([^&]+&)*(ll=-?[0-9]{1,2}\.[0-9]+,-?[0-9]{1,2}\.[0-9]+|q=[^&]+)+($|&)/;
    

    Hope it will cover all the urls now.

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

Sidebar

Related Questions

I have a string and I want to check that it only consists of
I want to check different variables BUT if only just one meets the condition
With php file_get_contents() i want just only the post and image. But it's get
I want to have the look of UITableViewCellStyleValue1 but instead of just only having
I have a FormCollection and I just want to only iterate through the keys
I just want to do a simple check of whether bluetooth is enabled on
I have some external Javascript files in my GWT app that I only want
I want to check that session is null or empty i.e. some thing like
Just got a question about codeigniters routing when you only want the first segment
I want read-only check boxes to be greyed out, but display their checked/unchecked status

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.