Skip to content

Instantly share code, notes, and snippets.

@mroger
Last active December 19, 2015 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mroger/5962666 to your computer and use it in GitHub Desktop.
Save mroger/5962666 to your computer and use it in GitHub Desktop.
Exemplo de validação de telefone usando regex em form HTML 5.
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Form Validation</title>
</head>
<body>
<form action='teste.asp'>
Telefone:
<input
type="text"
name="tel"
pattern="^\([1-9][1-9]\)(9[6-9]|[2-5])\d{3}[\.-\s]\d{4}"
title="Tel. com nono dígito">
<input type="submit">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment