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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:45:34+00:00 2026-06-02T17:45:34+00:00

Using the following URL example, how would I get the obtain the username from

  • 0

Using the following URL example, how would I get the obtain the username from it?

http://www.mysite.com/username_here801

A regex solution would be cool.

The following sample only gets the domain name:

  var url = $(location).attr('href');

  alert(get_domain(url));

  function get_domain(url) {
    return url.match(/http:\/\/.*?\//);
  }

jQuery solutions are also acceptable.

  • 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-02T17:45:34+00:00Added an answer on June 2, 2026 at 5:45 pm
    var url = "http://www.mysite.com/username_here801";    
    var username = url.match(/username_(.+)/)[1];
    

    http://jsfiddle.net/5LHFd/

    To always return the text directly after the slash that follows the .com you can do this:

    var url = "http://www.mysite.com/username_here801";
    var urlsplit = url.split("/");
    var username = urlsplit[3];
    

    http://jsfiddle.net/5LHFd/2/

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

Sidebar

Related Questions

I try to get this following url using the downloadURL function as follows: http://www.ncbi.nlm.nih.gov/nuccore/27884304
I'm using the following to define root while in development: define('LOCAL_URL', 'http://localhost/~xampp/Mysite'); define('REMOTE_URL', 'http://example.com');
I'm calling the following URL using YQL http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22UTG.L%22)%0A%09%09&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env&callback=cbfunc this returns the following in JSON
I'm using a GET variable and people get to it by the following URL:
How to get previous page URL using jQuery? I am using the following code
let's say I have a file located in: http://example.com/123.app now I get the file
I have the following so far: ^((http[s]?|ftp):\/\/)(([^.:\/\s]*)[\.]([^:\/\s]+))(:([^\/]*))?(((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(\?([^#]*))?(#(.*))?)?$ Been testing against these: https://www.google.com.ar:8080/dir/1/2/search.html?arg=0-a&arg1=1-b&arg3-c#hash https://google.com.ar:8080/dir/1/2/search.html?arg=0-a&arg1=1-b&arg3-c#hash https://google.com:8080/dir/1/2/search.html?arg=0-a&arg1=1-b&arg3-c#hash
I have the following links: <a href=http://example.com/src/abc.png><img src=http://example.com/res/bca.png></a> <a href=http://example.com/src/hvc.gif><img src=http://example.com/res/ncq.jpg></a> Using PHP, I
Say I have the following site: http://example.com/site that is the same of http://site.example.com I
I followed an example from the following url that shows how to use the

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.