I know this is a pretty basic regex, could someone explain what it is doing please?
^[^@]+@[-a-z0-9.]+$
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
^ – match start of string
[^@]+ – match one or more characters that aren’t an @
@ – match an @
[-a-z0-9.]+ – match one or more characters from the set ‘-‘, lower case ‘a’-‘z’, the digits ‘0’-‘9’, ‘.’
$ – match end of string
So, match any string that consists of some characters that aren’t ‘@’, followed by ‘@’, followed by some number of lower case letters / digits / dashes / full stops.