From: Kyle Date: 2008-04-16T01:11:59+09:00 Subject: Re: Reg Exp Match the route with /admin/ in the path first. map.connect ':lang/admin/:controller/:action/:id If it's matched, it won't go on and try to match the route that you showed us. This is really a RoR question. -Kyle On Apr 15, 8:42 am, "Jeff Schoolcraft" wrote: > I don't think you'll be able to do what you want with just a regex pattern. > The closest you could get is negative lookahead. You'd have to pull out the > first character and use negative lookahead for the rest, it will probably > only work for simple strings. > > irb(main):029:0> a = "Hello World" > => "Hello World" > irb(main):030:0> a =~ /h(?!ello)/i > => nil > irb(main):031:0> b = "Hel l o world" > => "Hel l o world" > irb(main):032:0> b =~ /h(?!ello)/i > => 0 > > On Tue, Apr 15, 2008 at 9:17 AM, Dipesh Batheja > wrote: > > > > > Problem is i have function, which takes a regex as the parameter. I want > > to pass this regex in such a way that the function returns false if the > > string is matched and true if it isn't. I want the regex itself specify > > that if it matches the given string then it is false otherwise true. > > > Jesús Gabriel y Galán wrote: > > > On Tue, Apr 15, 2008 at 2:59 PM, Dipesh Batheja > > > wrote: > > >> Can somebody hep me with a very simple regular expression. I want to > > >> write an regex which if matches a specific string should return false. > > >> for example: > > >> if i have string "Hello world", and i want to say, if you find "hello" > > >> in this string then return false. Can someone explain how to write > > this? > > > > Simple approach: > > > > irb(main):007:0> a = "hello world" > > > => "hello world" > > > irb(main):008:0> !(a =~ /hello/) > > > => false > > > irb(main):009:0> !(a =~ /asdfsdf/) > > > => true > > > > Jesus. > > > -- > > Posted viahttp://www.ruby-forum.com/. > > -- > Jeff Schoolcrafthttp://thequeue.net/blog/ > Microsoft MVP