Here’s an email: mynick@myemail.com
I need to store in a variable: myemail
To do so, I’m doing:
<script>
var email = "mynick@myemail.com";
justMyemail = email.replace(/.*\@|\./gi,'');
alert(justMyemail);
</script>
But the alert shows: myemailcom instead of myemail
What is wrong with the code? How can I fix it?
Thanks a lot
1 Answer