Path: csiph.com!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Jim Janney Newsgroups: comp.lang.java.programmer Subject: Re: regex reserved chars Date: Thu, 07 Feb 2013 20:47:55 -0700 Organization: bilaterally symmetric Lines: 35 Message-ID: References: <42t5h8d8ta5iq9nkfded0pvfl104cqhc77@4ax.com> <511300de$0$295$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: mx05.eternal-september.org; posting-host="c75a2e3068ccf6c98395286f3e40b97d"; logging-data="13397"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX191CVqvreG/bgEeeVcYqXO1" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:KYJ2lQXG3qxxbxuJzTUoddCkrIc= sha1:CZjQ9fUnEI69ShPelgi464s/Ni8= Xref: csiph.com comp.lang.java.programmer:22203 Martin Gregorie writes: > On Wed, 06 Feb 2013 20:18:19 -0500, Arne Vajhøj wrote: > >> On 2/6/2013 7:28 PM, Roedy Green wrote: >>> I have always treated $ ( ) * + -. ? [ \ ] ^ { | } >>> as reserved regex chars. >>> I can't find any docs that say the list is different inside[ ]. >>> is it? >> >> Typical it is. >> >> Regex syntax vary a bit between implementations. >> >> So one should study the documentation. >> >> java.util.regex.Pattern has an excellent JavaDoc. >> > That's normally the first place I look, but it doesn't answer Roedy's > question - apart, that is, from referring to the dead tree O'Reilly book. > Expanding the 'Character Classes' description in the Pattern class-level > documentation or linking to an online source would be more useful than > the implied suggestion of buying the book from Amazon and then waiting > for delivery. I have a copy of that book, in an earlier edition, but I usually find it more convenient to consult regular-expressions.info, e.g. http://www.regular-expressions.info/charclass.html which answers the question very nicely. It also explains things like lookbehind that the JavaDoc only hints at. -- Jim Janney