Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post2.news.xs4all.nl!newszilla.xs4all.nl!not-for-mail From: Eric Bednarz Newsgroups: comp.lang.javascript Subject: Re: ScreenName validation Organization: Eric Conspiracy Secret Labs References: <53ccd13b-a933-4bbc-ba0a-7061cc9064cd@4g2000yqv.googlegroups.com> Reply-To: ebednarz@gmx.net X-Eric-Conspiracy: There is no conspiracy Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Date: Fri, 11 Jan 2013 23:23:15 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3.50 (darwin) Cancel-Lock: sha1:0Hem65YBbm+l91EMh50Jd/YO1Bg= MIME-Version: 1.0 Lines: 36 NNTP-Posting-Host: 83.163.169.80 X-Trace: 1357942997 dreader36.news.xs4all.nl 6096 83.163.169.80:52455 Xref: csiph.com comp.lang.javascript:18077 Stefan Weiss writes: > Could you give an example of when the literal ] character doesn't have > to be escaped in a character class? I'm not sure what you are asking. Examples in other languages? $ php -r 'echo preg_match("/^[]]$/", "]"), "\n";' 1 $ irb >> /^[]]$/ =~ "]" (irb):1: warning: character class has `]' without escape => 0 $ python [...] >>> import re >>> re.compile('^[]]$').match(']') <_sre.SRE_Match object at 0x109e39168> $ groovysh [...] groovy:000> "]" ==~ /^[]]$/ ===> true > The empty character class is supported in many (but not all) PCRE-like > regex implementations. $ perl -e 'print "]" =~ /^[]]$/, "\n";' 1 > In addition to "\", "]", and "-", some languages also require the regex > delimiter to be escaped in regex literals. Well, some languages require you to .NOT escape the underscore. :-)