Possible Duplicate:
Regular expression for SSN and phone number
^(?!.*(\\d{16})|.*(\\d{9})|.*(\\d{3}-\\d{2}-\\d{4})|.*(\\d{3}-\\d{3}-\\d{3})).*
The above regex
does not allow SSN and phone number in the string. But It is also not allowing \n
(enter character). If user enters two lines of text by hitting enter this regex
fails.