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($p attern, $replacement, $string);
return $newString;
}
This finds no matches. Even when I feed it the above as a test line.
What have I done wrong.
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($p attern, $replacement, $string);
return $newString;
}
This finds no matches. Even when I feed it the above as a test line.
What have I done wrong.
Comment