Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Rafael Villar Newsgroups: comp.lang.java.programmer Subject: Re: Regex doesn't recognize single quote Date: Sun, 08 Jan 2012 09:10:45 +1000 Organization: Aioe.org NNTP Server Lines: 15 Message-ID: References: <74f4b448-24bf-448f-9f4a-06fd1b79c86d@o12g2000vbd.googlegroups.com> NNTP-Posting-Host: 1QofoA7r19pAiEX5BZLHVA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11096 Mea Culpa, Sorry, it seems Roedy didn't understand the original problem, and also I didn't understand what Roedy was understanding (sorry Roedy) Anyway, a simpler method that does what Roedy intends to do: /** remove ' and \w from string * @param s string to process * @return string without ' or \w */ private static String scrunch( final String s ) { return s.replaceAll("['\\w]+", ""); } However the original problem is unknown as the original code is actually working.