/ Published in: JavaScript

simple function to get querystring from a custom address using regular expression
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// usage: getQueryValue("http://localhost-vm/site/default.aspx?123deds=122223&winner=carneiro0&deds=123", "deds") // returns 123 var getQueryValue = function(p_str, p_param){ return (p_str ? p_str.match(new RegExp('(?:\\?|&|&)'+p_param+'=(.*?)(?:&|$)')) : [])[1]; };
Comments
