CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • International Phone Number Validator
Pages: [1]

Author Topic: International Phone Number Validator  (Read 776 times)

JohnFF

  • I post frequently
  • ***
  • Posts: 235
  • Karma: 6
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.28
  • MySQL version: 5.5.31-1
  • PHP version: 5.3.27
International Phone Number Validator
June 06, 2015, 06:17:52 pm
Dear Interational CiviCRM Community,

Well, the time has come to rewrite the UK Phone Number Validator. I looked at the code with the benefit of 18 months' CiviCRM extension development and shook my head in wonder.

The first major feature change is to make it support international numbers using regexes.

You would be helping me immeasurably if you could provide Regexes for both mobile and landline phone numbers of your nationality. Or, if you tell me the broad rules, I will do it as best I can.

I plan to add functionality to optionally replace country codes with 0s, and replace + with 00, etc before the regex is applied. Spaces, -s, and so on can optionally be removed as well.

Example:
'Australia Landline' => '^0[^4][0-9]{8}$',
'Australia Mobile'    => '^04[0-9]{8}$',
'British Landline'     => '^0[^7][0-9]{9}$',
'British Mobile'        => '^07[0-9]{9}$',

Thank you in advance,

JohnFF
If you like empowering charities in a free and open way, then you're going to love Civi.

Email Amender: https://civicrm.org/extensions/email-amender
UK Phone Validator: https://civicrm.org/extensions/uk-phone-number-validator
http://civifirst.com
https://twitter.com/civifirst

JohnFF

  • I post frequently
  • ***
  • Posts: 235
  • Karma: 6
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.28
  • MySQL version: 5.5.31-1
  • PHP version: 5.3.27
Re: International Phone Number Validator
October 17, 2015, 03:52:24 pm
This has now been made and released!
If you like empowering charities in a free and open way, then you're going to love Civi.

Email Amender: https://civicrm.org/extensions/email-amender
UK Phone Validator: https://civicrm.org/extensions/uk-phone-number-validator
http://civifirst.com
https://twitter.com/civifirst

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: International Phone Number Validator
October 21, 2015, 12:53:57 am
Cool!  :D
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • International Phone Number Validator

This forum was archived on 2017-11-26.