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 15:04:29 -0700 Organization: A noiseless patient Spider Lines: 13 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 25 May 2012 22:04:30 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="2kn9RzOWSe/v/hLnHgGT4Q"; logging-data="9898"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+w150T5c2YCK5Ncxrrx5OnwiZYaTl8sVc=" 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:4ZXIv1HziBUq4MEXp83P9+o3EhM= Xref: csiph.com comp.lang.java.programmer:14802 On 5/25/2012 2:55 PM, Lew wrote: > > Use a regex like "[\"'][^\"']+[\"']" is one way. The cleanest? I don't know. > This would match "John's restaurant" as "John'. The first quote matches ", John does not contain either ' or " as specified, and the last character class matches the '. Not I think what is wanted.