Help on Regular EXpression

hi
i need to validate user input for my designation field .
that field should accept(alphapets,numbers,-,&)
example => System support - Trainee
could u people help me with the reqular expression.
Thanks for any helps

/^([-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