I'm really new to regex in general. All I need is it to check and make sure (Something@something.something) works. I've tried this.
var checkEmail = /^\w+@\w+.[a-zA-Z]/;
Is something like this correct for what I'm looking for?
I'm really new to regex in general. All I need is it to check and make sure (Something@something.something) works. I've tried this.
var checkEmail = /^\w+@\w+.[a-zA-Z]/;
Is something like this correct for what I'm looking for?
To refine what you have:
var checkEmail = /^\w+@\w+\.[a-zA-Z]+/;
What you posted it close (you should escape the .
so it doesn't match any character and add a +
after the [a-zA-Z]
because top-level domains are at least 2 character I think), but for something like an email address that actually has a long and little known spec, I would just use someone else's regex.
Here's a site with more info:
You should escape the dot, otherwise it is a meta character that matches anything. Try:
/^\w+@\w+.[a-zA-Z]/