Reg Exp Test

Form

Haystack:


Needle:


Result

0){ echo "Needle:
" . $_POST['needle'] . "
"; echo "Haystack:
" . nl2br($_POST['haystack']) . "
"; echo "

Matches

"; $keepLooping = true; $returnStack = ""; $haystack = $_POST['haystack']; while($keepLooping){ $returnR = buildMatch($_POST['needle'],$haystack,$returnStack); $keepLooping = $returnR['keepLooping']; $returnStack = $returnR['returnStack']; if(!$keepLooping){ break; } $haystack = $returnR['haystack']; } echo "

". nl2br($returnStack) . "

"; ?> "; print_r($matchLength); echo "\r\n"; print_r($regs); echo ""; */ $strpos = strpos($haystack,$regs[0]); // echo $strpos; $returnStack .= substr ($haystack, 0, $strpos) . "" . substr ($haystack,$strpos,$matchLength) . ""; $returnR['haystack'] = substr($haystack,($strpos + $matchLength)); $returnR['returnStack'] = $returnStack; $returnR['keepLooping'] = true; return $returnR; }else{ $returnStack .= $haystack; $returnR['returnStack'] = $returnStack; $returnR['keepLooping'] = false; return $returnR; } } ?>