From: Logan Capaldo Date: 2004-11-12T12:07:00+09:00 Subject: Re: RegEx bug in 1.8.2? he shouldn't have to since he's using the /x modifier. Unfortunately I think the problem is that Ruby has no way to know that /x is there until it gets to it, and since it doesn't see it it assumes that / is the end of the regex. Doing it any other way would require arbitrary lookahead (I think, any parser guru's feel free to correct me). Perhaps you can do something like Regexp.new "your regex in a string". No I just tried that and it doesn't do it the right way. Aha! here we go: Regexp.new("(.*) # X / Y [abcde]", Regexp::EXTENDED) Yeah that works. In the future I guess you'll have to avoid / in comments for extended regular expressions, either that or escape them or use the method I just outlined. On Fri, 12 Nov 2004 11:54:00 +0900, Jason Sweat wrote: > On Fri, 12 Nov 2004 11:46:25 +0900, Bill Atkins wrote: > > bill@kaitain ruby $ ruby --version > > ruby 1.8.2 (2004-11-06) [x86_64-linux] > > > > bill@kaitain ruby $ cat regex_x_bug.rb > > regex = /(.*) # X / Y > > [abcde]/x > > I believe you need to excape the / with a \ > regex = /(.*) # X \/ Y [abcde]/x > > Jason > -- > http://blog.casey-sweat.us/ > >