Skip to content

Instantly share code, notes, and snippets.

@rainly
Forked from Suave/gist:107984
Created March 17, 2011 10:19
Show Gist options
  • Save rainly/874110 to your computer and use it in GitHub Desktop.
Save rainly/874110 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
<!--
function getQueryStringRegExp(name)
{
var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");
if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " ")); return "";
};
//http://localhost/test.html?aa=bb&test=cc+dd&ee=ff
alert(getQueryStringRegExp('test'));
//-->
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment