Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

decode html query string in javascript using replace function

Posted on 2004-09-02
4
Medium Priority
?
625 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
darksinclair earned 800 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

610 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