From: Austin Ziegler Date: 2003-05-13T07:32:58+09:00 Subject: Re: Regexp: why does (re)* return only last repetition? On Tue, 13 May 2003 00:02:34 +0900, Kent Dahl wrote: > Austin Ziegler wrote: >> On Mon, 12 May 2003 17:39:19 +0900, Robert Klemme wrote: >>> Clifford Heath: >>>> Robert Klemme wrote: >>>>> Clifford Heath: >>>>>> re = Regexp.new('[a-z\\]') >>>>> Why not simply do >>>>> re = /[a-z\\]/ >>>> Because it was part of a larger extended re. >>> But you can still use re = /.../ instead of re = Regexp.new >>> '...' >> Again, if and only if one is specifying the regular expression >> statically. > Am I missing something or just misunderstanding what you mean by > specifying it statically? It's the patttern specified specifically: "[a-z\\]". So far as I can tell, the backslash is being interpolated twice (once by String#new and once by Regexp#new). Is this a bug? I'm not sure, but I think so; it doesn't do it twice with "[\\a-z]", "[a-z\\\]", or "[a-z\\\\]". -austin -- Austin Ziegler, austin@halostatue.ca on 2003.05.12 at 18:29:34