Reposting my original question from yesterday: Hello, I was wodering if someone can tell me if the following is possible with regular expressions. I have a variable that contains text. (A paragraph or two...) I need to replace all occurances of "make" "take" "phase" etc.. with "meik" "teik" "pheis"... So basically a combination of "a?e" becomes "ei?" kinda like misspeling those words... Any ideas how to implement? -Mike
$string = preg_replace('/([aA])([a-zA-Z0-9])([eE])/', 'ei\2', $string);
thanks... i ended up doing something similar: $text = preg_replace("/(a(.)e)/e", "ei$2", $text); -Mike
Hello Mike,
do you HAVE to solve the problem using rexp??
why don“t you use the PHP-function 'str_replace'?
$sentence="Shake your leg, make my day"; $new_sentence=str_replace("ae","ei",$sentence);
=>"Sheike your leg, meike my day"
hth Chris
your preg statement doesn't work for anything but all-lower case.
that's the only real benefit of mine.
because he doesn't want =>"Sheike your leg, meike my day"
He wants =>"Sheik your leg, meik my day"
It has to be done with RE. You piece of code shouldn't work because "Shake your leg, make my day" has no occurances of "ei" and therefore str_replace() wouldn't work. -Mike