On Jun 9, 10:45 am, Frederick Cheung <[email protected]> wrote: > 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
Thanks Fred. This is a lot cleaner than the one I have now. On Jun 9, 11:17 am, Josh Cheek <[email protected]> wrote: > How are we supposed to help you when you haven't told us what this is > supposed to do? We could look at it and try to infer patterns and rules from > a single example that is not even real data, but we would have to make lots > of assumptions that could easily turn out to be false, especially since > you're saying you expected the result to be '*.doc' in the summary at the > end. What do you need a regex for at all? Sorry for not being clear, but I thought it was understandable in the end. > Also you have a syntax error, but it's easy enough to guess where the string > should have been terminated. Syntax error? You mean my typo at the end of the code? '*doc) when it should be '*doc') Sorry about that > You should answer these questions, because, looking at your regex, I doubt > it does what you intend it to. And if it does do what you intend it to, it > is probably not for the reasons you think. I think it does do what I indend for it to do. At least it seems so to me. Thanks for replying, 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

