Skip to content

Instantly share code, notes, and snippets.

@khoand0000
Created November 22, 2015 07:35
Show Gist options
  • Save khoand0000/764aff38ce8526c4b261 to your computer and use it in GitHub Desktop.
Save khoand0000/764aff38ce8526c4b261 to your computer and use it in GitHub Desktop.
remove phone (Vietnam) from content
$content = preg_replace('#[\d]{3,4}[\.\- \s]?[\d]{2,3}[\.\- \s]?[\d]{2,3}[\.\- \s]?[\d]{1,2}#mius', '...', $content);
// 0999990999
// 099 999 0999
// 099 999 09 99
// 099 99 90 99
// 0999 99 0999
// 0999 990 999
// 0999 99 09 99
// 09999999990
// 0999 999 9990
// 0999 99 999 90
// 0999 99 99 990
// 09999 99 99 90
// 09999 99 9990
// 09999 999990
// 09999 999 990
// 09999 9999 90
// the rule accept 12 numbers and catch all above cases, but ok, I just use it to remove phone not valid it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment