Hi,
Pretend I have the following string :
And I want to remove all occurrence of string "AutorefreshPage" from url.Code:var url = "http://localhost/MyWebSite/Diagnostic.aspx:8800?ID=1&AutorefreshPage=1&AutorefreshPage=z5d1a&AutorefreshPage=1&AutorefreshPage=1&AutorefreshPage=5584&AutorefreshPage=dafx&AutorefreshPage=1225aa";
So all those occurrences might be removed :
- &AutorefreshPage
- &AutorefreshPage=
- &AutorefreshPage=?...?
Here is what I did, but I'm not familliar with RegEx
It seem to replace only first occurence... But I think I'm far away of the solution.Code:var url = "http://localhost/QMBGateModem/Sites/BarriersDiagnostic.aspx?ID=1&AutorefreshPage=1&AutorefreshPage=254d&AutorefreshPage=21das&AutorefreshPage=ad55d&AutorefreshPage=1&AutorefreshPage=1&AutorefreshPage=2d5a5s1"; var p = url.replace( /(AutorefreshPage=)([a-zA-Z0-9]+)&/, '' ); window.alert( p );
Thanks for your support





Reply With Quote