Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28413
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail |
|---|---|
| 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 | Tue, 14 Jul 2015 16:38:09 +0200 |
| Organization | PointedEars Software (PES) |
| Lines | 44 |
| Message-ID | <2895053.KgIPk0JqQz@PointedEars.de> (permalink) |
| References | <9b0a260a-6988-469c-9f5a-aa738b847527@googlegroups.com> <mo14qf$8mk$1@speranza.aioe.org> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| X-Trace | solani.org 1436884878 10484 eJwFwQkBwDAIA0BLpYSwyuH1L2F3phSWg0bY2p6Rr8p4oaobkaE9c6L3Tftldj4XlULAsfkDLkQR4Q== (14 Jul 2015 14:41:18 GMT) |
| X-Complaints-To | abuse@news.solani.org |
| NNTP-Posting-Date | Tue, 14 Jul 2015 14:41:18 +0000 (UTC) |
| User-Agent | KNode/4.14.2 |
| X-User-ID | eJwNy7kBwDAIBLCVAuYd58Cw/whxqUJ6jKxdTE10dTmKKuUasUd8s3LKESVgH3UmXNJNIKnPoF/Y4WsJ5n7+AUxWFh0= |
| Cancel-Lock | sha1:+LFpbZVXiwvNDKDM65nAGV4WNxI= |
| X-NNTP-Posting-Host | eJwFwQkBACAIA8BK4hhiHOTpH8E7wsTyqNGUw7G5gA7Uu3uKkAcg6gQdWBnieBrcFb7S8wMcEREp |
| Xref | csiph.com comp.lang.javascript:28413 |
Show key headers only | View raw
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