Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?B?Sm9zaHVhIENyYW5tZXIg8J+Qpw==?= Newsgroups: comp.lang.java.programmer Subject: Re: regexp(ing) Backus-Naurish expressions ... Date: Sat, 09 Mar 2013 21:00:08 -0600 Organization: A noiseless patient Spider Lines: 18 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 10 Mar 2013 02:58:41 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="95ab4c362dcce54022543f80bbbb46d3"; logging-data="30329"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OvH3WepU8mboXF3sKmV295M2yQzWQXAI=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Thunderbird/20.0 In-Reply-To: Cancel-Lock: sha1:Dav2IU1upNLWlfygAgUATaNJJss= Xref: csiph.com comp.lang.java.programmer:22865 On 3/9/2013 8:27 PM, qwertmonkey@syberianoutpost.ru wrote: > One of the problems I am having is that if you enter as options say [true|t], > the matcher would match just the "t" of "true" and I want for "true" to be > actually matched another one is that, say, " true ", should be matched, as well > as "false [ nix |mac| windows ] line.separator" ... Do you know the syntax of Java's regular expressions? See . In short, anything contained within square brackets is considered to be a set of characters to match on, so [true|t] succeeds if the character it's matching against is a t, r, u, e, or |. The syntax you probably wanted was (true|t), which would either match the string "true" or the string "t". -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth