Am 13.06.2009 um 06:44 schrieb heimdull:

> /^([-a-z0-9\-\& ]+)$/i
>
> Should do it

I'd be careful with ^ and $ in regular expressions. I haven't tested  
it, but that would also match 'Some stuff\nSome other funny stuffäää',  
because ^ and $ match the beginning and end of a line, if your string  
has several lines, you won't test the whole string. If you really want  
to test the whole string, use \A and \Z to match the beginning and the  
end of the string. The Regex would be:

/\A[-a-z0-9\-\& ]+\Z/i

Anyway, you can also visit http://www.rubular.com/ to test your regexes.

Regards,

Felix
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to