RegEx to make sure that the string contains at least one lower case char, upper case char, digit and symbol

What is the regex to make sure that a given string contains at least one character from each of the following categories. Lowercase character Uppercase character Digit Symbol I know the patterns for individual sets namely [a-z], [A-Z], \d and _|[^\w] (I got them correct, didn’t I?). But how do I combine them to make … Read more

Regular expression to match standard 10 digit phone number

I want to write a regular expression for a standard US type phone number that supports the following formats: ###-###-#### (###) ###-#### ### ### #### ###.###.#### where # means any number. So far I came up with the following expressions ^[1-9]\d{2}-\d{3}-\d{4} ^\(\d{3}\)\s\d{3}-\d{4} ^[1-9]\d{2}\s\d{3}\s\d{4} ^[1-9]\d{2}\.\d{3}\.\d{4} respectively. I am not quite sure if the last one is … Read more