php - Break Row to Carriage Return preg_replace -



php - Break Row to Carriage Return preg_replace -

i trying utilize preg_replace convert <br> or <br /> carriage homecoming (&#13;). problem seems either doesn't find <br>'s or doesn't recognize hex code i'm trying pass in. here relevant php:

preg_replace('`<br(?: /)?>(\x{13}/u)`', '$1', $content);

other information: strings passing in have &quot; don't think interfere preg_replace(). here couple links have helped me far: http://www.webmasterworld.com/forum21/10973.htm (use carriage homecoming instead of \n in tooltips) http://us2.php.net/manual/en/reference.pcre.pattern.modifiers.php#58409 (use \x{13} instead of &#13)

hmmm, seem have preg_replace formatted little strange. not sure why doing backreferences that? simple this, first variable should regex. 2nd should replacement, , 3rd should subject:

preg_replace('%<br.*?>%', '&#13;', $content);

i think work, not great @ regexes. .*? should match characters next >

php

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -