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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:38:18+00:00 2026-05-27T10:38:18+00:00

var url_pattern = new RegExp((?:http| https)://(www.|.*)someurlhere[.]com/\d\d\d\d/\d\d/\d\d/.*/, i); var url=window.location; //or could be document.URL both

  • 0
var url_pattern = new RegExp("(?:http| https)://(www.|.*)someurlhere[.]com/\d\d\d\d/\d\d/\d\d/.*/", "i");
var url=window.location; //or could be document.URL both don't work
url.match(url_pattern);

why does it return null, or undefined but when i throw the Regex into a check it works perfect and i just want to make sure the URL matches

  • 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-27T10:38:19+00:00Added an answer on May 27, 2026 at 10:38 am

    You have issues with your slashes and an extra space before https and some period characters not escaped properly either.

    When using the new RegExp("string") format, you have to double escape any backslash. It’s much easier to use the /regexhere/ syntax because you don’t have to double escape the backslash used in so many regex rules.

    Also, a string has a regex method called .match(). The regex itself has a method called .test() or .exec(). I would suggest this:

    var url_pattern = /(?:http|https):\/\/(www\.|.*)someurlhere\.com\/\d\d\d\d\/\d\d\/\d\d\/.*\//i;
    window.location.href.match(url_pattern);
    

    If you want to stay with the other way of declaring it, you would escape every backslash like this:

    var url_pattern = new RegExp("(?:http|https)://(www\\.|.*)someurlhere[.]com/\\d\\d\\d\\d/\\d\\d/\\d\\d/.*/", "i");
    window.location.href.match(url_pattern);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

var url:String = http://www.[yourDomain].com/application.jsp; var request:URLRequest = new URLRequest(url); var variables:URLVariables = new URLVariables();
i can reference link with specific id with following code $(document).ready(function(){ $(a#example_link_id).click(function(event){ var url
HI I have a URL var str:String = conn=rtmp://server.com/service/&fileId=myfile.flv or var str:String = fileId=myfile.flv&conn=rtmp://server.com/service/
Given the following code: using (var client = new WebClient()) { string url =
function check(id){ var _id = document.getElementById(id); url = test.php?check=1&id= + _id; } i want
My document root is /var/www and I have no virtual hosts enabled. This is
def sss(request): handle=open('b.txt','r+') handle.write(I AM NEW FILE) var=handle.read(); return HttpResponse(var) urlpatterns = patterns('', ('^$',sss),
I have this piece of code: $(#faq).click(function () { var url = $.get(faq, {
This is an example code from the prototype site. var url = '/proxy?url=' +
Given the following javascript (jquery) $(#username).keyup(function () { selected.username = $(#username).val(); var url =

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.