I'm currently working on validating email addresses in my HTML page using an Angular directive.
From my perspective, a valid email address looks like this:
The regular expression I've been using allows for email addresses like "hello@mycompany."
What kind of regular expression could I implement to require the ".com" part of an email address, ensuring that there is a "." followed by any characters?
I have searched the internet and tried various regular expressions listed, but none seem to be effective.
<div class="form-group" ng-class="{ 'has-error': registerUpdateForm.Email.$invalid }">
<label class="col-sm-3 control-label" for="Email">Email Address</label>
<div class="col-sm-9">
<input required type="email" data-ng-model="auth.Email"
data-ng-pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
id="email" name="Email" class="form-control" /> <!--ng-pattern="matchPattern"/-->
</div>
</div>