# AJAX - passing huge strings

**URL:** <https://forum.kirupa.com/t/ajax-passing-huge-strings/273650>\
**Category:** programming\
**Created:** [October 18, 2008, 3:19am UTC](https://forum.kirupa.com/t/ajax-passing-huge-strings/273650 "2008-10-18T03:19:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)\
**Post date:** [October 18, 2008, 3:19am UTC](https://forum.kirupa.com/t/ajax-passing-huge-strings/273650/1 "2008-10-18T03:19:27Z")

</div>

[![](http://img508.imageshack.us/img508/9395/regexdr8.th.png)](http://img508.imageshack.us/my.php?image=regexdr8.png)

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:**

```php

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

```

**matchRegex.php:**

```php

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

```
