Question

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: abc23ss@1domain.ext

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

Was it helpful?

Solution

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:

some-thing.someone@somewhere.co.uk
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top