<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: 1.4 String.matches is dumb</title>
	<atom:link href="http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/</link>
	<description>Kevin Dangoor on Software Development</description>
	<pubDate>Sat, 22 Nov 2008 03:11:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Paula</title>
		<link>http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/#comment-209993</link>
		<dc:creator>Paula</dc:creator>
		<pubDate>Wed, 17 Sep 2008 02:45:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/wordpress/?p=735#comment-209993</guid>
		<description>Thanks for saving me time!  Java Docs did not imply this behavior, and I wasted lots of time till finding your blog.  I first started using grep and regular expressions in '89.  If there going to do something so differently, it really should be clearly delineated in the docs.</description>
		<content:encoded><![CDATA[<p>Thanks for saving me time!  Java Docs did not imply this behavior, and I wasted lots of time till finding your blog.  I first started using grep and regular expressions in &#8216;89.  If there going to do something so differently, it really should be clearly delineated in the docs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Sheedy</title>
		<link>http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/#comment-209851</link>
		<dc:creator>Jason Sheedy</dc:creator>
		<pubDate>Fri, 08 Aug 2008 07:03:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/wordpress/?p=735#comment-209851</guid>
		<description>5 years on and this issue still raises it's ugly head. I just wasted 30 minutes trying to figure out this unexpected behaviour !!!</description>
		<content:encoded><![CDATA[<p>5 years on and this issue still raises it&#8217;s ugly head. I just wasted 30 minutes trying to figure out this unexpected behaviour !!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antonio</title>
		<link>http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/#comment-208954</link>
		<dc:creator>Antonio</dc:creator>
		<pubDate>Wed, 18 Jun 2008 22:56:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/wordpress/?p=735#comment-208954</guid>
		<description>Look, I have no perl background at all (rather javascript, smalltlak, and yes, java...) and this behaviour is dumb. In fact, it's a violation of the protocol as Loren points out - if it claims to match a regex, and the regex doesn't specify ^$, then it mustn't work as if it did, bc it's just wrong. I'd go as far as deprecating the method (since it's just not possible to fix it, as there are probably too many people depending on the BUGGY behaviour).
And yes, the java lot are arrogant about stuff like this. At times there are good explanations for why somthing works in a particular way, but you won't be given that explanation bc the people answering won't know - but they'll know hoe to tell you to get lost.</description>
		<content:encoded><![CDATA[<p>Look, I have no perl background at all (rather javascript, smalltlak, and yes, java&#8230;) and this behaviour is dumb. In fact, it&#8217;s a violation of the protocol as Loren points out - if it claims to match a regex, and the regex doesn&#8217;t specify ^$, then it mustn&#8217;t work as if it did, bc it&#8217;s just wrong. I&#8217;d go as far as deprecating the method (since it&#8217;s just not possible to fix it, as there are probably too many people depending on the BUGGY behaviour).<br />
And yes, the java lot are arrogant about stuff like this. At times there are good explanations for why somthing works in a particular way, but you won&#8217;t be given that explanation bc the people answering won&#8217;t know - but they&#8217;ll know hoe to tell you to get lost.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/#comment-208410</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Mon, 31 Mar 2008 01:04:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/wordpress/?p=735#comment-208410</guid>
		<description>My Perl background was undoing me as well. An implicit ^ and $ is the kind of thing that should be written in very LARGE letters within the documentation. And it still isn't in 1.6.

Thanks for the very useful comments.</description>
		<content:encoded><![CDATA[<p>My Perl background was undoing me as well. An implicit ^ and $ is the kind of thing that should be written in very LARGE letters within the documentation. And it still isn&#8217;t in 1.6.</p>
<p>Thanks for the very useful comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rupali</title>
		<link>http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/#comment-208204</link>
		<dc:creator>Rupali</dc:creator>
		<pubDate>Wed, 05 Mar 2008 07:44:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/wordpress/?p=735#comment-208204</guid>
		<description>Thanks to u Guys..I would have wasted so much time in this! String.matches is hopeless...</description>
		<content:encoded><![CDATA[<p>Thanks to u Guys..I would have wasted so much time in this! String.matches is hopeless&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith</title>
		<link>http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/#comment-197757</link>
		<dc:creator>Keith</dc:creator>
		<pubDate>Mon, 24 Sep 2007 20:52:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/wordpress/?p=735#comment-197757</guid>
		<description>Ditto on the thoughts echoed above. I just wasted over an hour trying to resolve why a simple regex wouldn't match a particular string. If your going to mess with the regex under the covers, you should be up front about it in the documentation!</description>
		<content:encoded><![CDATA[<p>Ditto on the thoughts echoed above. I just wasted over an hour trying to resolve why a simple regex wouldn&#8217;t match a particular string. If your going to mess with the regex under the covers, you should be up front about it in the documentation!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/#comment-110890</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 13 Mar 2007 06:40:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/wordpress/?p=735#comment-110890</guid>
		<description>Kevin's absolutely right on this. Perl hacker or not, there's no reason to secretly pull the "^$" characters into the match. Regex is very much an explicit form language, if you don't specify "this is the beginning of the string, and this is the end of the string", then there is no assumed beginning or end. This essentially makes it a pseudo regex. That said, ".*MYMATCH.*" is a nice and easy (but stupid) workaround.</description>
		<content:encoded><![CDATA[<p>Kevin&#8217;s absolutely right on this. Perl hacker or not, there&#8217;s no reason to secretly pull the &#8220;^$&#8221; characters into the match. Regex is very much an explicit form language, if you don&#8217;t specify &#8220;this is the beginning of the string, and this is the end of the string&#8221;, then there is no assumed beginning or end. This essentially makes it a pseudo regex. That said, &#8220;.*MYMATCH.*&#8221; is a nice and easy (but stupid) workaround.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NGS</title>
		<link>http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/#comment-69849</link>
		<dc:creator>NGS</dc:creator>
		<pubDate>Wed, 04 Oct 2006 22:43:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/wordpress/?p=735#comment-69849</guid>
		<description>I was expecting String.matches() to work like Matcher.find() and is provided as a convenience method. But, Sun implemented using the literal meaning of 'matches' (matches the entire string) and 'find'(find the pattern) instead of what the developers want! API should make that point clear of what the method does.</description>
		<content:encoded><![CDATA[<p>I was expecting String.matches() to work like Matcher.find() and is provided as a convenience method. But, Sun implemented using the literal meaning of &#8216;matches&#8217; (matches the entire string) and &#8216;find&#8217;(find the pattern) instead of what the developers want! API should make that point clear of what the method does.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pitr</title>
		<link>http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/#comment-60619</link>
		<dc:creator>Pitr</dc:creator>
		<pubDate>Wed, 02 Aug 2006 11:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/wordpress/?p=735#comment-60619</guid>
		<description>I second that: matches seems to ignore your string (ie: always false) whenever it contains a newline.

Back to a custom static method.</description>
		<content:encoded><![CDATA[<p>I second that: matches seems to ignore your string (ie: always false) whenever it contains a newline.</p>
<p>Back to a custom static method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>http://www.blueskyonmars.com/2003/10/31/14-stringmatches-is-dumb/#comment-32461</link>
		<dc:creator>George</dc:creator>
		<pubDate>Fri, 14 Apr 2006 21:46:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/wordpress/?p=735#comment-32461</guid>
		<description>I was equally frustrated by the default.  My default expectation is that .matches would be doing a search within the string.  One other method documented here: http://javaalmanac.com/egs/java.lang/HasSubstr.html

is to use the "abcdef".indexOf("de") &#62;= 0  -- the equals in case you actually do this "abcdef".indexOf("ab")</description>
		<content:encoded><![CDATA[<p>I was equally frustrated by the default.  My default expectation is that .matches would be doing a search within the string.  One other method documented here: <a href="http://javaalmanac.com/egs/java.lang/HasSubstr.html" rel="nofollow">http://javaalmanac.com/egs/java.lang/HasSubstr.html</a></p>
<p>is to use the &#8220;abcdef&#8221;.indexOf(&#8221;de&#8221;) &gt;= 0  &#8212; the equals in case you actually do this &#8220;abcdef&#8221;.indexOf(&#8221;ab&#8221;)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.550 seconds -->
<!-- Cached page served by WP-Cache -->
