On Jun 9, 2:37 pm, anon_comp <neocools...@gmail.com> wrote: > Here's my code > > def index > file = "BLAH-ex201588.doc" > @file_cut = order.gsub(/[\w [- ! # $ % ^ & * = +]+]+\.doc$/, > '*.doc) > end > > The code worked before when I was using Ruby 1.9.1, but now I'm using > Ruby 1.8.7 due to technical reasons. I would imagine that it should > still work, but I doesn't. If I removed the nested brackets and it's > contents, it'll work, but will only cut the string to "BLAH-*.doc" > instead of "*.doc" > ruby 1.9 uses a different regular expression. I think that if you want to include a - in a character class then it should be the last thing in it. /[\w ! # $ % ^ & * = +-]+\.doc$ works for me
Fred > Please help. > > Thanks, > Anon_comp -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.