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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:49:18+00:00 2026-06-03T19:49:18+00:00

I cannot find out the regex to get param value from the part of

  • 0

I cannot find out the regex to get param value from the part of query string:

I need to send parameter name to a method and get parameter value as result for string like
"p=1&qp=10".
I came up with the following:

function getParamValue(name) {

  var regex_str = "[&]" + name + "=([^&]*)";

  var regex = new RegExp(regex_str);

  var results = regex.exec(my_query_string);
  // check if result found and return results[1]

}

My regex_str now doesn’t work if name = 'p'. if I change regex_str to

var regex_str = name + "=([^&]*)";

it can return value of param 'qp' for param name = 'p'

Can you help me with regex to search the beginning of param name from right after '&' OR from the beginning of a string?

  • 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-03T19:49:20+00:00Added an answer on June 3, 2026 at 7:49 pm

    This might work, depending on if you have separated the parameter part.

    var regex_str = "(?:^|\&)" + name + "=([^&]*)";
    or
    var regex_str = "(?:\&|\?)" + name + "=([^&]*)";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ive tried searching for hours now and cannot find out why my code (aka,
i tried to find it out with previous answers but i cannot do it
I cannot find a way to get a Book's Ratings through the Books API
I need to find out, which database is used by default when I create
I have had a search and cannot find what I need, the answers all
I cannot find out how to list and print all objects in a workspace.
I cannot find out what this line is doing: p = struct.pack(>b, x)+p[1:] can
So I've been searching around and cannot find out exactly how to do this.
I feel stupid but cannot find out how to add a text to a
I've been mandated to find out what IBM Cognos does, and I cannot find

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.