-2

what sort of a regex pattern should i use to check if an email is in this patter, xxxxxxx@my.hello.co.uk

xxx being letters and numbers

tried this [a-zA-Z0-9._-]+@[my.hello]+.[ac]+.[uk]

doesn't work though

  • 2
    There's so many answers here on SO on that topic. Have you done your research? – Roko C. Buljan Mar 20 '14 at 19:34
  • used this ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[my]+(\.ello+)*(\.ac.uk)$... but if its with m.hello.co.uk it still works.. cant get it to work with the exact match for my.hello.co.uk – user3117384 Mar 20 '14 at 19:38

1 Answers1

0

Try:

[a-zA-Z0-9]+@my\.hello\.co\.uk

The dot '.' is a special char meaning "any char". You must escape it with the slash '\'. I dropped the underscore, the hyphen, and the dot from your 'xxx' part because you want only letters and numbers.

You must aware that

0zkr@my.hello.co.uk

will be valid (star with a zero digit :) May be you want to read Jquery validating email using RegEx

Community
  • 1
  • 1
0zkr PM
  • 825
  • 9
  • 11