Posted by lawrence k on 12/05/05 05:47
I do not know much about regex.
I'm worried about lines like this:
<a href="myFile>my file</a>
There is only one quote mark in that html.
I wanted to fix this problem, so I tried this:
function command($string=false) {
$pattern = '/(.*)<a (.*)"(.*)>/i';
$replacement = '$1<$2"$3">';
$newString = preg_replace($pattern, $replacement, $string);
return $newString;
}
This finds no matches. Even when I feed it the above as a test line.
What have I done wrong.
[Back to original message]
|