Skip to content

Regular expression with all details (not start with dot,number , is it possible to use multiple dot but not in a row and so on)

Notifications You must be signed in to change notification settings

AliRezvaniAra/the-best-regular-expression-gmail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

best regular expression for gmail

Gmail Regular expression with all details (not start with dot,number , is it possible to use multiple dot but not in a row and so on)

Gmail regular expression (Full version)

In this mini project I'm going to introduce great pattern or regular expression for GMAIL input and validating them every where that you want.

Usage in PHP

dd(preg_match('/^[^0-9^.][a-zA-Z0-9]+(\.?[a-z]+)*@gmail.com/', 'ali.rezvaniara@gmail.com'))
# returns 1/true

dd(preg_match('/^[^0-9^.][a-zA-Z0-9]+(\.?[a-z]+)*@gmail.com/', 'ali..rezvaniara@gmail.com'))
# returns 0/false

dd(preg_match('/^[^0-9^.][a-zA-Z0-9]+(\.?[a-z]+)*@gmail.com/', '2ali.rezvaniara@gmail.com'))
# returns 0/false


dd(preg_match('/^[^0-9^.][a-zA-Z0-9]+(\.?[a-z]+)*@gmail.com/', 'ali2.rezvaniara@gmail.com'))
# returns 1/true

dd(preg_match('/^[^0-9^.][a-zA-Z0-9]+(\.?[a-z]+)*@gmail.com/', '.ali.rezvaniara@gmail.com'))
# returns 0/false

Usage in HTML

<!DOCTYPE html>
<html>
<body>

<h1>Example of using GMAIL regular expression in html</h1>

<form action="/action_page.php">
  <input type="text" id="email" name="email" pattern="^[^0-9^.][a-zA-Z0-9]+(\.?[a-z]+)*@gmail.com" >
  <input type="submit">
</form>

<p>
  <strong>Note:</strong>
  The pattern attribute of the input is not supported in Safari 10 (or earlier).
</p>

</body>
</html>

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

About

Regular expression with all details (not start with dot,number , is it possible to use multiple dot but not in a row and so on)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages