<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://regexadvice.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Construction Advice</title><link>http://regexadvice.com/forums/68/ShowForum.aspx</link><description>&lt;P&gt;Find help building expressions to suit your needs. Consult the &lt;A href="http://regexlib.com"&gt;Regular Expression Library&lt;/A&gt; to find many pre-built expressions, and add your own once you've solved your construction problem in our forum.&lt;/P&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2.1 (Build: 60809.935)</generator><item><title>replace characters(seperators) within quotes</title><link>http://regexadvice.com/forums/thread/73979.aspx</link><pubDate>Thu, 18 Nov 2010 16:15:56 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:73979</guid><dc:creator>speedster</dc:creator><slash:comments>0</slash:comments><comments>http://regexadvice.com/forums/thread/73979.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=68&amp;PostID=73979</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hi I am debugging a pear package (File_CSV).&lt;/p&gt;&lt;p&gt;At some point for a line all seperators within quotes need to be replaced with an underscore. &lt;/p&gt;&lt;p&gt;The code that is being used right now:&lt;/p&gt;&lt;p&gt;$orgLine = &amp;#39;1001;&amp;quot;test1&amp;quot;;&amp;quot;semicolon ; in this string&amp;quot; &amp;#39;; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;$line = preg_replace(&amp;quot;|^[^&amp;quot;\&amp;#39;;]*;*([&amp;quot;\&amp;#39;][^&amp;quot;\&amp;#39;]*[&amp;quot;\&amp;#39;])|sm&amp;quot;, &amp;#39;_&amp;#39;, $orgLine); &lt;/p&gt;&lt;p&gt;It is faulty. &lt;/p&gt;&lt;p&gt;I guess the tricky part is within quotes is valid only if lefthand quote-position= oneven and righthand quote-position=even , otherwise the semicolon is used as a seperator.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Anyone any suggestiones? &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>