You are here: regex question - can't get unclosed quote marks inside of HTML tags « PHP Programming Language « IT news, forums, messages
regex question - can't get unclosed quote marks inside of HTML tags

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация