[Javascript] Re: Javascript probem in HTML Form

Shawn Milo milo at linuxmail.org
Fri May 21 10:05:14 CDT 2004


> 
> 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') 


This last one may work, but if you're going
to do it that way, I think you can even shorten
it from:

/(\?|\&).*rd=([^\&]*).*$/
to
/.*rd=([^\&]*).*$/    <-- (untested)

Since you're using that .* in there.
Personally, I prefer to write the regex
to completely match the whole string, but
I don't know if that's necessarily better.

Shawn




More information about the Javascript mailing list