AJAX - passing huge strings

I’m storing a whole HTML file’s text into var HTML. I’m allowing the user to type in a regex and match it in that HTML file. The problem is that I have to pass that regex and the HTML to the PHP file to process. I checked Firebug and spaces and other symbols have been replaced by %#, making pregmatch_all break. I have tested this exact regex with this exact HTML outside of the AJAX environment and it does work.

javascript:


function matchRegex(regexName)
{
	var regex = document.getElementById(regexName).value;
	ajax("matchRegex.php?regex=" + regex + "&html=" + HTML, regexName + "Match");
}

matchRegex.php:


<?php
	preg_match_all('#' . $_GET['regex'] . '#', $_GET['html'], $match);
	print_r($match);
?>