regex - php regular expression...weird behavior -


what's wrong in expression?

echo preg_replace("/condizioni/","ciao","<tr bla vla condizioni"); 

it not return anything...

anyway works when remove "<" char...but don't understand why...is special char, , if i have match literally.

thank you...

it work want (code on ideone). thing echo "<tr bla vla ciao"; in web page cause troubles. have escape html chars.

htmlspecialchars() :

echo htmlspecialchars(preg_replace("/condizioni/","ciao","<tr bla vla condizioni")); 

it echo &lt;tr bla vla ciao.


Comments

Popular posts from this blog

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -