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

  • Home
  • SEARCH
  • 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 8273161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:23:01+00:00 2026-06-08T07:23:01+00:00

Say I have a string &something=variable&something_else=var2 I want to match between &something= and &,

  • 0

Say I have a string “&something=variable&something_else=var2”

I want to match between &something= and &, so I’ll write a regular expression that looks like:

/(&something=).*?(&)/

And the result of .match() will be an array:

["&something=variable&", "&something=", "&"]

I’ve always solved this by just replacing the start and end elements manually but is there a way to not include them in the match results at all?

  • 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-08T07:23:06+00:00Added an answer on June 8, 2026 at 7:23 am

    You’re using the wrong capturing groups. You should be using this:

    /&something=(.*?)&/
    

    This means that instead of capturing the stuff you don’t want (the delimiters), you capture what you do want (the data).

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

Sidebar

Related Questions

So let's say we have a string that is like this: ‰û]M§Äq¸ºþe Ø·¦ŸßÛµÖ˜eÆÈym™ÎB+KºªXv©+Å+óS—¶ê'å‚4ŒBFJF󒉚Ү}Fó†ŽxöÒ&‹¢ T†^¤(
I have a string and I want to match something at the start and
Let's say I have this string: Hello &, how are you? I'm fine! Is
Say i have a string that i need to evaluate in javascript such as
Say I have the string 1,2,3,4,5 and I want to convert this to an
Let's say that I have a boost::variant<std::string, int> myVariant; In this object I keep
Is there any way that you can combine predicates? Lets say I have something
I have an abstract Logger class with a virtual Log(std::string const&) method. That way
Let's say we have something like: &firstString=someText&endString=OtherText And I would like to replace someText
Let's say I have strings like this: PH&N 2015 LifeTime Series D PH&N 2020

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.