Solved

decode html query string in javascript using replace function

Posted on 2004-09-02
4
616 Views
Last Modified: 2009-07-29
hey i need a regular expression to pass into the jscript replace function.

all i'm trying to do is replace the %20 from the query string that gets passed over with the space that was originally there.  

thanks
0
Comment
Question by:das165227
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
darksinclair earned 200 total points
ID: 11963731
Could you just use strQuery = strQuery.split("%20").join(" "); ?
0
 

Author Comment

by:das165227
ID: 11963861
yeah that works too.  

i'm curious as to why this won't work though if anyone wants to post for the hek of it and since its pretty simple.  

var regExpression= /%20/;
text= text.replace(regExpression," ");
0
 
LVL 5

Expert Comment

by:darksinclair
ID: 11965618
I'm not 100% sure on regular expressions.. but from what I know I think this is close to trim white spaces...

 var objRegExp = /^(\s*)$/;
0
 

Author Comment

by:das165227
ID: 11967342
i'm not wanting one to trim white spaces.  i was wanting one to look for the %20 in the jscript replace function.  i thought the code you gave me earlier worked but theres a problem with it somewhere.  i'm not sure where but its messing the html up somewhere that i'm passing over through the query string.  i'll post the question again
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now