Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?B?Sm9zaHVhIENyYW5tZXIg8J+Qpw==?= Newsgroups: comp.lang.java.programmer Subject: Re: regex tidy Date: Sun, 25 May 2014 13:31:31 -0500 Organization: A noiseless patient Spider Lines: 26 Message-ID: References: <375vn9th0bc1faa04eg136be53hbvfjq4v@4ax.com> <8m54o913tjf1sagk75ktn7a0960nugpovv@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 25 May 2014 18:31:43 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="8b6ddcc38ecbed2f71b30fabadb8aa0b"; logging-data="3799"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+7jV5/SP+pXDfV/G3BKizXxTUxPjFJBic=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Thunderbird/30.0 In-Reply-To: <8m54o913tjf1sagk75ktn7a0960nugpovv@4ax.com> Cancel-Lock: sha1:w1rrrDvdCNlOwDhgQ2nfxe7dXHY= Xref: csiph.com comp.lang.java.programmer:28561 On 5/25/2014 11:21 AM, Roedy Green wrote: > On Sat, 24 May 2014 14:55:03 +0200, Robert Klemme > wrote, quoted or indirectly quoted > someone who said : > >>> 7. use negative char lists when it would shorten the list. >> >> I don't believe this has any impact as this is something the regex >> engine will do internally. > > I was thinking of a transform something like one that searched for > every character but " by specifying every ascii char but one. It could > be simplified to use a negative. Perhaps the author had never heard > of negative searches. That wouldn't be correct. The original regex would not match, e.g., Õ, while your converted one would. [Although this does raise the question of how regular expressions handle or fail to handle characters like 💩 or the penguin in my display name. Stupid UTF-16 and the "it's fixed-width characters if you look at it funny" results.] -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth