Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28413
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Regular expression for email or mobile number in one field like facebook email/mobile field in registration |
| Date | 2015-07-14 16:38 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <2895053.KgIPk0JqQz@PointedEars.de> (permalink) |
| References | <9b0a260a-6988-469c-9f5a-aa738b847527@googlegroups.com> <mo14qf$8mk$1@speranza.aioe.org> |
Joao Rodrigues wrote: > On 12-07-2015 00:55, ashokacharya1988@gmail.com wrote: >> Regular expression for email or mobile number in one field like >> facebook email/mobile field in registration It does not make sense to repeat the subject line verbatim in the message body. >> I am building a registration form in in which i am trying a make a field >> say email/mobile where user can either put email address or mobile >> number with country code.similiar approach is used in facebook >> registration.can anyone have solution for such regular expression. i >> am building the form using angularjs with its default validator. > > You may try the HTML5 input type=email [1] which has good support by > modern browsers [2]. > > Also, check out an example Regex by Cody Lindley at debuggex [3]. Lindley’s expression is insufficient, not least because of new TLDs [1]. The HTML5 Specification has a better expression in the referred section insofar that it supports those; however, it does not support IDNs which should be encoded with Punycode by the HTTP client, not the user [2]. However, you have overlooked that the OP is using AngularJS, and had they googled for “angular e-mail” they would have found the proper solution for them already. Of course, it will be difficult to have the *same* input field for an e-mail address *or* a mobile phone number *and* properly validate either. An e- mail address is not a valid phone number and vice-versa; and phone numbers cannot be properly validated in an international context, which means they cannot be properly recognized, which means that they cannot be told from an invalid e-mail address. [1] <http://newgtlds.icann.org/en/program-status/delegated-strings> [2] <https://en.wikipedia.org/wiki/Internationalized_domain_name> -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix> Please do not cc me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
Regular expression for email or mobile number in one field like facebook email/mobile field in registration ashokacharya1988@gmail.com - 2015-07-11 20:55 -0700
Re: Regular expression for email or mobile number in one field like facebook email/mobile field in registration "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-07-12 11:07 +0200
Re: Regular expression for email or mobile number in one field like facebook email/mobile field in registration Steven D'Aprano <steve@pearwood.info> - 2015-07-12 22:05 +1000
Re: Regular expression for email or mobile number in one field like facebook email/mobile field in registration Dr J R Stockton <reply1500@merlyn.demon.co.uk.invalid> - 2015-07-13 23:13 +0100
Re: Regular expression for email or mobile number in one field like facebook email/mobile field in registration Steven D'Aprano <steve@pearwood.info> - 2015-07-14 12:47 +1000
Re: Regular expression for email or mobile number in one field like facebook email/mobile field in registration Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-07-13 16:50 -0300
Re: Regular expression for email or mobile number in one field like facebook email/mobile field in registration Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-14 16:38 +0200
csiph-web