GX - Glob Execute

Regular Expression:

This simple page allows you to match JavaScript expressions against text. All matches are inserted into the second box, one match per line.

It also includes the historic "PTQ" (parse-the-query) function, allowing the webmasters of all the Internet the ability to set custom globs, via the query string "?g=x" where x is some arbitrary regular expression.

The function itself:

function ptq(s) {
	var q={}, i, p; s=s.split('&');
	for (i=0; i<s.length; i++) {
		p = s[i].split('=', 2);
		q[unescape(p[0])] = unescape(p[1]);
	}
	return q;
}

To access a real query string:

tq = ptq(location.search.substring(1).replace(/\+/g, ' '));

The PTQ function does not support multiple like-named values.

Related items


Everything is free.

This resource is created by Joseph K. Myers, using tools written by Joseph Myers, e_mayilme (at) hotmail (dot) com.

http://www.myersdaily.org/joseph/javascript/gx.html