vigi98 said:
Thanks for this very helpfull solution. Nevertheless, what is the
solution ? I also tried this:
strURLpiece.replace(/&/,"%26");
but it does not work better.
This worked in ie 6.0 and mozilla 1.6:
alert("UK & Ireland".replace(/[&]/g,"%26"));
RegExp is for me so tricky to use that I made a small testbed to have
exercises in using it:
function evaluoi(r,s){
var re=new RegExp(r);
var myArray=new Array();
if (re){
myArray=re.exec(s);
if (myArray){alert(myArray.length+'\n'+myArray+'\n'+re.source);}
return re.test(s) ;
}
return false;
}
<form name="fname" action="#" method="get">
RegExp=
<input name="r" type="text" value="(\d{5})([a-z]*)(\s)+(\*$)"><br>
string=
<input name="s" type="text" value="12345abc *"><br>
RegExp.test(string)=
<input name="a" type="text" value="?"><br>
<input type="button" value="evaluoi"
onclick="document.forms['fname'].a.value=evaluoi(document.forms['fname'].r.value,document.forms['fname'].s.value);">
</form>
You can ignore the initial example values in the form fields.
Note that typing expressions to a form is different from using the
expressions in the progrmam code.