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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:10:52+00:00 2026-06-15T13:10:52+00:00

The goal is to parse out the arguments embedded in the hash portion of

  • 0

The goal is to parse out the arguments embedded in the hash portion of a URL. Someone on StackOverflow community provided the following code as a response to a similar question. The community chose this code as a suitable answer and it was therefore integrated into my own code as follows:

Utils.parseQueryStringArgs=function(queryString){
    var result = {}, queryString = queryString.substring(1),
        re = /([^&=]+)=([^&]*)/g, m;

    while (m = re.exec(queryString)) {
            result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
    }

    return result;
}

Having zero knowledge of regular expressions, the ‘re’ variable above is meaningless to me but yet the structure of the code makes sense. It’s worked flawlessly until choking on the following expression:

friendlySeriesName=Test%3A%20Fund.Feeder%20[class%20A]%20%26gt%3B%26gt%3B%20Morgan%2C%20Harry%20%40%201

The expected behavior is to parse out a property name of “friendlySeriesName” and a property value of “Test Fund.Feeder [class A] >> Morgan, Harry @ 1”. What’s happening, however, is a proper parsing of the property name and a parsed value of “Test: Fund.Feeder [class A]”. Everything beyond the greater than signs (“>>”) is getting dropped by this parsing function.

QUESTION: Can you modify the value of the variable ‘re’ in such a way that the function above works properly on the sample expression provided or alternatively, provide a foolproof way to parse out key-value pairs from the hash of an encoded url 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-15T13:10:53+00:00Added an answer on June 15, 2026 at 1:10 pm

    The problem is not the JavaScript code. The problem is the value that is supplied in the query string.

    Some code somewhere is encoding > as > first (i.e. as an HTML character entity) and then URI-escaping the ampersand and semi-colon leaving %26gt%3b. Doh!

    FWIW, one quick “hack” is to first convert %26gt%3b to %3e (or >):

    // original stuff
    var result = {}, queryString = queryString.substring(1),
        re = /([^&=]+)=([^&]*)/g, m;
    // hack
    queryString = queryString.replace(/%26gt%3b/g, "%3e");
    // rest as normal
    

    This may need to be done for other problematic initial encodings (e.g. < as &lt; and & as &amp;) as well.

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

Sidebar

Related Questions

My goal is to parse a class and return a data-structure (object, dictionary, etc)
My goal is to parse HTML with lxml, which supports both XPath and CSS
Goal: Parse a string from an input type text into TIME type to be
I have the following Sinatra code: post '/bucket' do # determine if this call
I am trying to figure out how to subtrack time. My #1 goal is
My goal is to create an personal application out of my ActionScript3 video player.
I have a snippet of code im trying to parse with nokogiri that looks
I am trying to parse the following xml. I can access the WeekNumber easily
I am parsing an XML file from a URL, from this XML I parse
Goal : I wants when I drag image it become fade so we can

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.