Skip to content

Instantly share code, notes, and snippets.

@valeriu
Created April 9, 2013 00:37
Show Gist options
  • Select an option

  • Save valeriu/5341918 to your computer and use it in GitHub Desktop.

Select an option

Save valeriu/5341918 to your computer and use it in GitHub Desktop.
The [patern]{x} quantifier matches any string that contains a sequence of x paterns.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chiffre</title>
</head>
<body>
<script type="text/javascript">
var chiffre = /^([0-9]{3})*$/;
document.write((chiffre.exec("357")) ? true : false); // true
document.write("<br /><br />");
document.write((chiffre.exec("3577878787")) ? true : false); // false
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment