So my problem is I am looking to match a certain combination of letters at the start of an email address followed by an @ and then a wildcard, for example:
admin@* OR noreply@* OR spam@* OR subscribe@
Can this be done?
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.
Try this
See it here on Regexr
You need an anchor at the start to avoid matching address with other characters before. If the string contains only the email address use
^at the beginning, this matches the start of the string. If the email address is surrounded by other text, the use\bthis is a word boundary.(?:admin|noreply|spam|subscribe)is a non capturing group, becuase of the?:at the start, then there is a list of alternatives, divided by the|character.\S*is any amount of non white characters, this will match addresses that are not valid, but should not hurt too much.