".$text."";
// At some point, we might care about the order this is done
if ($choosewords === "yes" ) {
$wordarray = explode(" ",$words); // could use a regex here
$n = count($wordarray);
//$newtext = $text;
for($i=0; $i < $n; $i++)
{
$word = $wordarray[$i];
$pattern = "/(?=([^>])*<)\b(".$word.")\b/i"; // improve checking to make sure not in a tag?
$replacement = "$2";
$newtext = preg_replace($pattern, $replacement, $newtext);
}
}
// Match all coronal consonents - th, t,h,s at the beginning of words
if ($cor === "yes" ) {
$pattern = '/(?=([^>])*<)\b(th|[ths])/i';
$replacement = "$2";
$newtext = preg_replace($pattern, $replacement, $newtext);
}
// Match all vowels -- aeiou
if ($vow === "yes" ) {
$pattern = '/(?=([^>])*<)([aeiou]+)/';
$replacement = "$2";
$newtext = preg_replace($pattern, $replacement, $newtext);
}
// Match all punctuation(any non chars, digits, or spaces
if ($pun === "yes" ) {
$pattern = '/(?=([^>])*<)([^A-Za-z0-9\s<>])/'; // there's a specific regex for punctuation, eh?
$replacement = "$2";
$newtext = preg_replace($pattern, $replacement, $newtext);
}
// Match all labial consonents -- mbp
if ($lab === "yes" ) {
$pattern = '/(?=([^>])*<)([mbp])/i';
$replacement = "$2";
$newtext = preg_replace($pattern, $replacement, $newtext);
}
// Match all dorsal consonents -- cg at the beginning of a word
if ($dor === "yes" ) {
$pattern = '/(?=([^>])*<)\b([cg])/i';
$replacement = "$2";
$newtext = preg_replace($pattern, $replacement, $newtext);
// Match words typed by user
// (delimiter: space)
}
// Replace carriage returns with '
'
$pattern = '/\r/';
$replacement = "
";
$newtext = preg_replace($pattern, $replacement, $newtext);
}
?>
";
echo $newtext;
}
?>