Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of regular expressions commonly used in JavaScript

Shulou Source: shulou.com Published: 2022-06-01 04:34:38 10月03日 Update

This article mainly introduces the example analysis of regular expressions commonly used in JavaScript, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.

Common regular expressions

/ / Mobile phone number regular var reg = / ^ 1 [0-9] {10} $/; / ID card number (18 digits) regular var cP = / ^ [1-9]\ d {5} (18 | 19 | ([23]\ d))\ d {2} ((0 [1-9]) | (10 | 11 | 12)) (([0-2] [1-9])) | 10 | 20 | 30 | 31)\ d {3} [0-9Xx] $/ / / Mailbox regular var reg = / ^ ([a-zA-Z] | [0-9]) (\ w |\ -) + @ [a-zA-Z0-9] +\. ([a-zA-Z] {2heli4}) $/ / / call method! reg.test (phone) / / Thank you for reading this article carefully. I hope the article "sample Analysis of regular expressions commonly used in JavaScript" shared by the editor will be helpful to you. At the same time, I hope you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Regular expression article common use example analysis mobile phone mobile number value interest at the same time method more friends knowledge ribbon industry certificate number information information channel Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple Redmi Docker Microsoft