<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1029389" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1029389</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/regular-expression#comment-1173146</link>
    <description> &lt;p&gt;try:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;echo &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;preg_replace_callback&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;!&amp;lt;address&amp;gt;\s*(.+)\s*&amp;lt;/address&amp;gt;!isU\&quot;, \&quot;nl2br\&quot;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$string&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Thu, 16 Jun 2005 04:25:25 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1173146 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/regular-expression#comment-1172164</link>
    <description> &lt;p&gt;It almost works. It adds s to every newline regardless of where they are. So&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;hello world&lt;br /&gt;&amp;lt;address&amp;gt;&lt;br /&gt;23 blah&lt;br /&gt;blah blah&lt;br /&gt;&amp;lt;/address&amp;gt;&lt;/code&gt;&lt;/div&gt;&#039;&lt;br /&gt;
becomes&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;hello world&amp;lt;br&amp;gt;&lt;br /&gt;&amp;lt;address&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;23 blah&amp;lt;br&amp;gt;&lt;br /&gt;blah blah&amp;lt;br&amp;gt;&lt;br /&gt;&amp;lt;/address&amp;gt;&amp;lt;br&amp;gt;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;Thanks tho.  Someone gave me a solution on another forum...&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;$string = &amp;lt;&amp;lt;&amp;lt;END&lt;br /&gt;&amp;lt;address&amp;gt;&lt;br /&gt;You and Yours&lt;br /&gt;Your Home Address&lt;br /&gt;Your Home State&lt;br /&gt;&amp;lt;/address&amp;gt;&lt;br /&gt;END;&lt;br /&gt;&lt;br /&gt;function ins_BR($arr){&lt;br /&gt;return $arr[1].str_replace(&amp;quot;\r\n&amp;quot;, &amp;quot;&amp;lt;br /&amp;gt;\n&amp;quot;,$arr[2]).$arr[3];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$pattern = &amp;quot;/(&amp;lt;address&amp;gt;\r\n)+([^&amp;lt;]+)+(&amp;lt;\/address&amp;gt;)/&amp;quot;;&lt;br /&gt;echo preg_replace_callback($pattern, &amp;quot;ins_BR&amp;quot;, $string);&lt;/code&gt;&lt;/div&gt;&#039;&lt;br /&gt;
which works fine excepts it adds a  to the last line between the  tags. If there are two lines, only the first should get the .&lt;/p&gt;
 </description>
     <pubDate>Tue, 31 May 2005 13:40:54 +0000</pubDate>
 <dc:creator>jbjaaz</dc:creator>
 <guid isPermaLink="false">comment 1172164 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/regular-expression#comment-1171872</link>
    <description> &lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$newhtml &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;eregi_replace&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;quotemeta&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;&amp;lt;address&amp;gt;\\0&amp;lt;/address&amp;gt;\&quot;),\&quot;&amp;lt;address&amp;gt;\\0&amp;lt;/address&amp;gt;\&quot;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$html&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;/* doesn&#039;t really do anything, just converts the section to variable, will need &lt;br /&gt;an array or loop if more than one instance */&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$newhtml&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = str_replace(\&quot;\n\&quot;,\&quot;&amp;lt;br /&amp;gt;\&quot;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$newhtml&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;/* &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$newhtml&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; should be the orginal value with changes made */&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Try that, I haven&#039;t tested it but should work, note quotemeta() and \\0 should remain&lt;br /&gt;
Could also be done in a loop, but seems you only want to change \n to  in certain areas&lt;/p&gt;
 </description>
     <pubDate>Fri, 27 May 2005 22:18:27 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1171872 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
