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