Skip to content

Instantly share code, notes, and snippets.

@emohamed
Created November 24, 2014 05:11
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 emohamed/cd4a1c1e927c836facc2 to your computer and use it in GitHub Desktop.
Save emohamed/cd4a1c1e927c836facc2 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Credit Card Numbers Normalization Example</title>
</head>
<body>
<script type="text/javascript">
// var creditCardNumber = '00000000 00000000';
// console.log(creditCardNumber.replace(/[^0-9]/, ''));
creditCardNumber = '0000-0000-0000-0000';
console.log(creditCardNumber.replace(/[^0-9]/g, ''));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment