Skip to content

Instantly share code, notes, and snippets.

View AllanPooley's full-sized avatar
💃

Allan Pooley AllanPooley

💃
View GitHub Profile
@AllanPooley
AllanPooley / AussiePhoneValidation.js
Created July 25, 2018 00:48
Australian Phone Number Validation in JavaScript
const isPhone = (phoneNumber) => {
const cleanedPhoneNumber = phoneNumber.replace(/-|\s/g, ''); // Remove spaces and hyphens before performing test
const pattern = new RegExp('^(?:\\+?(61))? ?(?:\\((?=.*\\)))?(0?[2-57-8])\\)? ?(\\d\\d(?:[- ](?=\\d{3})|(?!\\d\\d[- ]?\\d[- ]))\\d\\d[- ]?\\d[- ]?\\d{3})$');
return pattern.test(cleanedPhoneNumber);
};
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AllanPooley
AllanPooley / LookHappyIconBlack.svg
Last active August 8, 2017 22:03
LookHappyIconBlack
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.