FSM for email address format validation [closed]

Tag: regex , validation , fsm , finite-state-machine Author: zrqaabb Date: 2013-12-30

Have come up with the following Finite State Machine for validating an email based on the following pattern. Is this valid to be able to validate an emailaddress format (more specifically, is the FSM a correct translation of the regex below)?

enter image description here

Further, even when valid, the stages S4 and S5 can be removed (repeating states) and instead S1 can be an accepting state?

Email address format example: [email protected]t

Regex as a base for drawing the FSM: [a-z0-9][email protected][a-z0-9]+\.[a-z0-9]+

Best Answer

I guess it's not a bad starting point, but it's not quite there yet, and you will have to revise your FSM quite a bit. For example, the following email address would be invalid according to your FSM:

[email protected]


Agreed, it does not handle all possible email addressess but was looking for the confirmation of this 'first draft'.