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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:18:52+00:00 2026-06-15T16:18:52+00:00

I have a standard URL e.g. http://www.test.com/test1/test2.html I am using javascript in riak for

  • 0

I have a standard URL e.g.

http://www.test.com/test1/test2.html

I am using javascript in riak for map reduce and would like to only extract http://www.test.com. So…the domain and the subdomain.

What is the most efficient method to do this in js since I will have millions of records?

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-15T16:18:53+00:00Added an answer on June 15, 2026 at 4:18 pm

    Look at this answer: https://stackoverflow.com/a/8498629/623400

    var matches = url.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
    var domain = matches && matches[1];  // domain will be null if no match is found
    

    Sophisticated domain matching is kinda tricky, but all this is covered quite well in the linked post.

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

Sidebar

Related Questions

Say I have this URL: http://www.domain.com/subpage/?somsearch#somehash ? Is there a standard way to get
If I have URL A say http://www.example.com/ and another, say http://www.example.com . What would
Let's say I have a url such as: http://www.example.com/hello.png?w=100&h=100&bg=white What I'd like to do
I came across the following URL today: http://www.sfgate.com/cgi-bin/blogs/inmarin/detail??blogid=122&entry_id=64497 Notice the doubled question mark at
I have two pages made using HTML and I use the following standards <!DOCTYPE
I'd like to use the standard MongoDB ReST interface ( http://www.mongodb.org/display/DOCS/Http+Interface ) to search
I'm working on a site http://www.infinite-possibility.com/ which is currently having a problem with any
I have a website www.mysite.com running behind a load balancer. There are two servers
so suppose my server is located in http://www.example.com I then put a file file.exe
Like the Delicious submission bookmark-let, I'd like to have some standard JavaScript I can

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.