You are missing start and end anchor tag so you can refer this link Regular expressions with validations in RoR 4 and your correct regex will be,
/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
You should try this regex also for email validation, this regex will fulfill your all requirement and checking all the required possible validation.
^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$
and Here is explanation of regex which will be useful for understanding validation
^ #start of the line
[_A-Za-z0-9-\\+]+ # must start with string in the bracket [ ], must contains one or more (+)
( # start of group #1
\\.[_A-Za-z0-9-]+ # follow by a dot "." and string in the bracket [ ], must contains one or more (+)
)* # end of group #1, this group is optional (*)
@ # must contains a "@" symbol
[A-Za-z0-9-]+ # follow by string in the bracket [ ], must contains one or more (+)
( # start of group #2 - first level TLD checking
\\.[A-Za-z0-9]+ # follow by a dot "." and string in the bracket [ ], must contains one or more (+)
)* # end of group #2, this group is optional (*)
( # start of group #3 - second level TLD checking
\\.[A-Za-z]{2,} # follow by a dot "." and string in the bracket [ ], with minimum length of 2
) # end of group #3
$ #end of the line
Tested output:
Email is valid : abc@yahoo.com , true
Email is valid : abc-100@yahoo.com , true
Email is valid : abc.100@yahoo.com , true
Email is valid : abc111@abc.com , true
Email is valid : abc-100@abc.net , true
Email is valid : abc.100@abc.com.au , true
Email is valid : abc@1.com , true
Email is valid : abc@gmail.com.com , true
Email is valid : abc+100@gmail.com , true
Email is valid : abc-100@yahoo-test.com , true
Email is valid : abc , false
Email is valid : abc@.com.my , false
Email is valid : abc123@gmail.a , false
Email is valid : abc123@.com , false
Email is valid : abc123@.com.com , false
Email is valid : .abc@abc.com , false
Email is valid : abc()*@gmail.com , false
Email is valid : abc@%*.com , false
Email is valid : abc..2002@gmail.com , false
Email is valid : abc.@gmail.com , false
Email is valid : abc@abc@gmail.com , false
Email is valid : ab c@gmail.com , false
Email is valid : abc@gmail.com.1a , false