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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:51:02+00:00 2026-05-20T09:51:02+00:00

I am rejigging some urls that have been defined in javascript: var x =

  • 0

I am rejigging some urls that have been defined in javascript:

var x = "http:\/\/example.com\/test.aspx?v=12.1&x=2&p=3";
var y = "http:\/\/example.com\/test.aspx?v=92.1&x=2&p=4";

My regex to capture the domain part, the path and the querystring into a capture group works great:

(http:\\/\\/example.com\\/)([0-9a-zA-Z-\\\/\._]+)([\?]?)(.+)`

However the sand in the vaseline is that the last double quote is being matched as well. How do a stop matching just before the end quote?

As it happens this is for IIS7’s UrlRwriter so I can’t use any code to strip the end quote off.

  • 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-20T09:51:02+00:00Added an answer on May 20, 2026 at 9:51 am

    I assume you don’t allow quotes in the URL body, so you could just change the (.+) to ([^"]+).

    Edit: It occurs to me you might need to allow for " or ', so you could just change the above to ([^"']+). If you want to be more thorough, you can go with

    ([^"']+)(http:\\/\\/example.com\\/)([0-9a-zA-Z-\\\/\._]+)([\?]?)(.+?)\1

    …and ignore the first capture group. This way, it takes everything up to the next matching quote. That’s probably unnecessary, though. I can’t imagine that you’d want to allow ' or " in your URL string, but the . already matches several characters that aren’t supposed to be in URLs, so I thought I’d leave it up to you.

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

Sidebar

Related Questions

I've had quite a few problems and know that I can get some good
I am presenting my modal view using UIModalPresentationFormSheet and I am aware some have
ASP.Net MVC 3 using C# I currently have a form with some dropdown lists
I have an application where the contents of e-mails that get sent are stored
You may have noticed that we now show an edit summary on Community Wiki
I have a UITableView with some cells containing UITextField objects and others with UIButton
In my application I have an NSSearchField that is bound to an arraycontroller which
I have place this question before on following link with code & screenshot. TableView
Inside my applicationWillResignActive, I have to do certain functions that are just intended to
I'm rejigging our deploy scripts, and have moved to external config files for each

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.