Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: simple regex pattern sought Date: Fri, 25 May 2012 18:43:59 -0700 Organization: A noiseless patient Spider Lines: 14 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 26 May 2012 01:44:01 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="ayApTal7F+uyxlbK5HEKzA"; logging-data="15400"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19m19bJS+ZHWBAU98t3A3C4u6yfmbjHjJk=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: Cancel-Lock: sha1:vri3HQhEvUnRr7xjcLVB5PK8Ygs= Xref: csiph.com comp.lang.java.programmer:14807 On 5/25/2012 3:12 PM, Robert Klemme wrote: > "\"(?:\\\\.|[^\\\"])*\"|'(?:\\\\.|[^\\'])*'" This looks overly baroque to me. You don't need to escape \ single quotes ' in a Java string, and I don't think you need to in a regex either (although I didn't check that). I'm also not seeing the need for the parenthesis around the character classes [] (but again, without having tried it, I could be wrong). And the dot . inside the parenthesis just looks wrong. Great post overall though.