View Full Version : Resolved regex quick help - im an idiot :P

06-18-2009, 10:00 PM
hi there

regex help is required please!

I need my regex to find chkEP[]= from an url string so i use :

function getValeurURL(nom)
//nom = chkEP[]=
nom = nom.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+nom+"=([^&#]*)";
//regexS = chkEP\[\]=
var regex = new RegExp( regexS );
var resultat = regex.exec( window.location.href );
//window.location.href = http://blabla?chkEP[]=5
if( resultat == null )
return "";
return resultat;

this regex wont find my chkEP[]= at all :S

edit : wow i'm tired. I have to use %5B%5D for URL brackets xD