[Javascript] Re: Javascript probem in HTML Form

Flavio Gomes flavio at economisa.com.br
Fri May 21 08:47:23 CDT 2004


Shawn Milo wrote:

>I modified your style to my own readability preferences.  Hope you don't mind.
>
>Shawn
>
>
>
>(...)
>
>  var returnVal = location.search.replace(/^\?rd=(.*)$/, '$1');
>  
>
I suggest a little change, because I believe that "rd" is not always 
coming nor first nor last in location.search:  
  I'm trying like crazy to make it work, but I can't o.o
My idea would be the following:    
     replace(/(\?|\&)rd=([^\&]*)/, '$2');
 Searches for a "?" or "&" followed by "rd=" and then get everything 
untill it finds a "&" (or the end of the line).
But it doesnt worked.. do you know why Shawn?


PS.: While writing the mail I got a working one, but, if you know, may you explain why the above one doesn't works?
   replace(/(\?|\&).*rd=([^\&]*).*$/, '$2') 

-- 
Flavio Gomes
flavio at economisa.com.br




More information about the Javascript mailing list