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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:33:19+00:00 2026-05-30T14:33:19+00:00

For the URL http://questions/ask/stackoverflow.xhtml , the requirement is obtain stackoverflow. What is the pattern

  • 0

For the URL http://questions/ask/stackoverflow.xhtml, the requirement is obtain stackoverflow.
What is the pattern used to obtain this page name?
The substring can be used but I read that the performance for pattern Matcher would be better.

  • 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-30T14:33:21+00:00Added an answer on May 30, 2026 at 2:33 pm

    For that particular URL you can use:

    String url = "http://questions/ask/stackoverflow.xhtml";
    String pname = url.split("/")[4].split("\\.")[0];
    

    For the more useful (in terms of regex not in performance) Pattern based solution consider this:

    String url = "http://questions/ask/stackoverflow.xhtml";
    Pattern pt = Pattern.compile("/(?![^/]*/)([^.]*)\\.");
    Matcher matcher = pt.matcher(url);
    if(matcher.find()) {
        System.out.println("Matched: [" + matcher.group(1) + ']');
        // prints Matched: [stackoverflow]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine this is my URL NSURL *theURL=[NSURL URLWithString:@http://stackoverflow.com/questions/ask]; How can i extract only: http://stackoverflow.com
This is an example URL. http://stackoverflow.com/questions/ask?a=1&b=2 question : I need to fetch path name
For instance, this url is http://stackoverflow.com/questions/ask , instead of something like http://stackoverflow.com/questions/ask.aspx . How
NSString *url = @http://stackoverflow.com/questions/ask; How can I get the character position of the 4th
I have a long web url in my xsl variable. eg. @url = http://stackoverflow.com/questions/ask/2434/35454
If I have this URL: http://stackoverflow.com/question/ask?type=great How do I get the complete route and
I noticed that HTTP://STACKOVERFLOW.COM/QUESTIONS/ASK and http://stackoverflow.com/questions/ask both works fine - actually the previous one
I found and followed an example from Stackoverflow (http://stackoverflow.com/questions/2310139/how-to-read-xml-response-from-a-url-in-java) of how to read an
The URL http://www.fourmilab.ch/cgi-bin/Earth shows a live map of the Earth. If I issue this
I want this url http://www.youtube.com/watch?v=dgNgODPIO0w&feature=rec-HM-fresh+div to be transformed to: http://www.youtube.com/v/dgNgODPIO0w with php.

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.