<!-- 
RSS generated by JIRA (4.4#649-r158309) at Thu May 23 07:24:08 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://dev.clojure.org/jira/si/jira.issueviews:issue-xml/CLJ-753/CLJ-753.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Clojure JIRA</title>
    <link>http://dev.clojure.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>4.4</version>
        <build-number>649</build-number>
        <build-date>25-07-2011</build-date>
    </build-info>

<item>
            <title>[CLJ-753] clojure.string/replace-first returns nil with replacement fn when regex doesn&apos;t match</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-753</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;&lt;a href=&quot;https://groups.google.com/d/topic/clojure/wDO1u7wRmDQ/discussion&quot;&gt;Originally reported by Takahiro Hozumi&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With a function as the &quot;replacement&quot; argument, clojure.string/replace-first returns nil if there is no match, instead of returning the original string unchanged.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;user=&amp;gt; (use &apos;clojure.string)
nil
user=&amp;gt; (replace-first &lt;span class=&quot;code-quote&quot;&gt;&quot;abcdef&quot;&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;ghi&quot;&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;jkl&quot;&lt;/span&gt;)
&lt;span class=&quot;code-quote&quot;&gt;&quot;abcdef&quot;&lt;/span&gt;
user=&amp;gt; (replace-first &lt;span class=&quot;code-quote&quot;&gt;&quot;abcdef&quot;&lt;/span&gt; #&lt;span class=&quot;code-quote&quot;&gt;&quot;ghi&quot;&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;jkl&quot;&lt;/span&gt;)
&lt;span class=&quot;code-quote&quot;&gt;&quot;abcdef&quot;&lt;/span&gt;
user=&amp;gt; (replace-first &lt;span class=&quot;code-quote&quot;&gt;&quot;abcdef&quot;&lt;/span&gt; #&lt;span class=&quot;code-quote&quot;&gt;&quot;ghi&quot;&lt;/span&gt; (fn [a] &lt;span class=&quot;code-quote&quot;&gt;&quot;jkl&quot;&lt;/span&gt;))
nil&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="14369">CLJ-753</key>
            <summary>clojure.string/replace-first returns nil with replacement fn when regex doesn&apos;t match</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="4" iconUrl="http://dev.clojure.org/jira/images/icons/priority_minor.gif">Minor</priority>
                    <status id="6" iconUrl="http://dev.clojure.org/jira/images/icons/status_closed.gif">Closed</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="stuart.sierra">Stuart Sierra</assignee>
                                <reporter username="stuart.sierra">Stuart Sierra</reporter>
                        <labels>
                    </labels>
                <created>Fri, 11 Mar 2011 07:54:15 -0600</created>
                <updated>Fri, 1 Mar 2013 12:47:01 -0600</updated>
                    <resolved>Fri, 24 Aug 2012 07:41:03 -0500</resolved>
                                            <fixVersion>Approved Backlog</fixVersion>
                                        <due></due>
                    <votes>2</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="26322" author="fbrubacher" created="Mon, 21 Mar 2011 07:36:49 -0500"  >&lt;p&gt;This is my patch for this issue. I have a CA signed. Any suggestions and i can try again. Federico&lt;/p&gt;</comment>
                    <comment id="27353" author="cperkins" created="Mon, 28 Nov 2011 09:31:31 -0600"  >&lt;p&gt;Same fix as Frederico&apos;s patch, but also removes unnecessary allocation of a StringBuffer when there is no match, for both replace and replace first.&lt;/p&gt;</comment>
                    <comment id="27354" author="cperkins" created="Mon, 28 Nov 2011 09:46:03 -0600"  >&lt;p&gt;Same again, but with docstring typo fixes too.&lt;/p&gt;</comment>
                    <comment id="27355" author="steveminer@gmail.com" created="Mon, 28 Nov 2011 10:12:17 -0600"  >&lt;p&gt;You should use StringBuilder instead of StringBuffer.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/questions/355089/stringbuilder-and-stringbuffer-in-java&quot;&gt;http://stackoverflow.com/questions/355089/stringbuilder-and-stringbuffer-in-java&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="27356" author="cperkins" created="Mon, 28 Nov 2011 10:37:56 -0600"  >&lt;p&gt;Yup, that&apos;s what I thought, but it turns out it doesn&apos;t work because java&apos;s Matcher/appendReplacement requires a StringBuffer, unfortunately.&lt;/p&gt;</comment>
                    <comment id="27360" author="jafingerhut" created="Mon, 28 Nov 2011 17:09:40 -0600"  >&lt;p&gt;I&apos;ve tested Chris&apos;s clojure-string-with-no-match-returns-original-2.patch against latest github Clojure as of this morning, and the tests pass.  Cool that he found a straightforward performance improvement for the no match case.  The code appears correct.  I also verified that for the reason Chris mentions, StringBuilder will not work as a replacement for StringBuffer.  At least there will never be any contention on the locks implementing the StringBuffer synchronization the way they are used here.&lt;/p&gt;</comment>
                    <comment id="27363" author="stuart.sierra" created="Tue, 29 Nov 2011 08:45:01 -0600"  >&lt;p&gt;Vetted &amp;amp; moved to Approved Backlog.&lt;/p&gt;</comment>
                    <comment id="27544" author="jafingerhut" created="Thu, 12 Jan 2012 00:06:50 -0600"  >&lt;p&gt;&lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-870&quot; title=&quot;clojure.string/replace behaves unexpectedly when \ or $ are part of the result string&quot;&gt;&lt;del&gt;CLJ-870&lt;/del&gt;&lt;/a&gt; has an attached proposed combined patch for this issue and that one.&lt;/p&gt;</comment>
                    <comment id="29223" author="jafingerhut" created="Sat, 18 Aug 2012 12:09:29 -0500"  >&lt;p&gt;This issue should now be corrected with the patch, attached to &lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-870&quot; title=&quot;clojure.string/replace behaves unexpectedly when \ or $ are part of the result string&quot;&gt;&lt;del&gt;CLJ-870&lt;/del&gt;&lt;/a&gt;, that was applied on Aug 18, 2012.&lt;/p&gt;</comment>
                    <comment id="29257" author="stuart.sierra" created="Fri, 24 Aug 2012 07:41:03 -0500"  >&lt;p&gt;&lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-753&quot; title=&quot;clojure.string/replace-first returns nil with replacement fn when regex doesn&amp;#39;t match&quot;&gt;&lt;del&gt;CLJ-753&lt;/del&gt;&lt;/a&gt; patch applied for &lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-870&quot; title=&quot;clojure.string/replace behaves unexpectedly when \ or $ are part of the result string&quot;&gt;&lt;del&gt;CLJ-870&lt;/del&gt;&lt;/a&gt; addresses this one, too, applied Aug 18, 2012 &lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10157" name="0001-clojure.string-replace-first-now-returns-the-origina.patch" size="1598" author="fbrubacher" created="Mon, 21 Mar 2011 07:36:49 -0500" />
                    <attachment id="10721" name="clojure-string-with-no-match-returns-original-2.patch" size="4460" author="cperkins" created="Mon, 28 Nov 2011 09:46:03 -0600" />
                    <attachment id="10720" name="clojure-string-with-no-match-returns-original.patch" size="3262" author="cperkins" created="Mon, 28 Nov 2011 09:31:31 -0600" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                <customfield id="customfield_10002" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Approval</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10003">Vetted</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                    <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                            <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Patch</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10002">Code and Test</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                        </customfields>
    </item>
</channel>
</rss>