0

Somehow I find it really hard to create a RegEx on my own and I am sure one of you does know how to work with them. My question: I want users, who register, to only be able to enter an email address of this format: ?.????@example.com.

To clear up, my RegEx should look for if there is only one character in the first position, followed by a dot, an infinite number of characters, an at-symbol, followed by "example.com".

Is it even possible to allow RegEx to look for full strings (example.com in this case) and if so, what would that RegEx look like? (I'd like an full example).

EDIT: By characters I mean alphanumeric characters (^[a-zA-z]$)

Thanks in advance!

J van Amerongen
  • 67
  • 3
  • 13
  • you say alphanumeric but example only contains alphabet – Ashraful Islam Jan 28 '17 at 12:56
  • Parsing emails with regex isn't simple at all, I would recommend to read [this](http://www.regular-expressions.info/email.html) article, it explains the trade-offs in using one regex over another and what are some standards to use (even with standards, there are still some trade-offs). – alturkovic Jan 28 '17 at 13:05

1 Answers1

1

Here is the regex :

^[a-zA-Z0-9]\.[a-zA-Z0-9]+@example\.com$

Demo and Explanation : https://regex101.com/r/BPFHvl/4

Ashraful Islam
  • 11,113
  • 3
  • 28
  • 48