Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Example Analysis of regular expression matching URL, phone, Mobile phone and mailbox in html

Shulou Source: shulou.com Published: 2022-06-02 06:26:29 11月12日 Update

Editor to share with you in html regular expression matching URL, phone, mobile phone, mailbox example analysis, I hope you will learn something after reading this article, let's discuss it together!

Regular expression, also known as regular expression. (English: Regular Expression, often abbreviated as regex, regexp or RE in code), a concept in computer science. Regular tables are often used to retrieve and replace text that conforms to a certain pattern (rule).

The specific code is as follows:

Regular verification var text = document.getElementById ('text'); var btn = document.getElementById (' btn') / / 1 、 Url example: / / https://www.baidu.com/s?wd=%E5%88%98%E5%BE%B7%E5%8D%8E&rsv_spt=1&rsv_iqid=0x9601edc200017402&issp=1&f=8&rsv_bp=1&rsv_idx=2&ie=utf-8&rqlang=cn&tn=baiduhome_pg&rsv_enter=1&oq=javascript%2520%25E9%259A%25BE%25E9%25A2%2598&inputT=1256&rsv_t=7da5GmMhTie86h8qaOiaV047P9TkJunMjrkmK%2BNLA%2FuJs3bMG%2Bj52w%2F6IxHge5MB%2B%2B%2Fw&rsv_pq=c270d50b00019cae&rsv_sug3=21&rsv_sug1=19& Rsv_sug7=100&rsv_sug2=0&rsv_sug4=1818//2 、 Phone example: / / 13800138000 Universe + 8610-59926666 + (1) 533-2222-334 Uniqpare 010-59926666x037132376865 E-mail example: / / Handsome.W@abc.com//_hello_world@163.com//345@mail.some_domain_name.com.uk// var regexp=/ ^ ([0-9amurzAmurazizhi. -]) + @ ([0-9aMurzAmurzizhi -]) + (\. ([aMuzaMuthazizhi -]) +) + $/ / / mailbox / / var regexp=/ (https?.*?\. (:? cn\ b | com\ b | net\ b | org\ b | gov\ b) (?!\)) /; / / URL// var regexp=/\ +?\ d {3jue 4} -?\ d {7jue 8} /; / 010-59926666 8610-59926666 037132376865way / var regexp=/\ + (\ d {3} -) {2}\ d {3} / / / + (1) 533-2222-334 var regexp=/ (1 [34578]\ d {9}) | (\ +?\ d {3pm 4} -?\ d {7jue 8}) | (\ +\ (\ d\) (\ d {3} -) {2}\ d {3}) / / / Tel: 13800138000010-59926666 8610-59926666 037132376865 + (1) 533-334var regexp=/ (([0-9aMohamzAmurazizhi.]) + @ ([0-9aMuszAmurzizhi -]) + (. (https?.*?\. (:? cn\ b | com\ b | net\ b | org\ b | gov\ b) (?!\.)) | (1 [34578]\ d {9}) | (\ +?\ d {3pr 4} -?\ d {7pr 8}) | (\ +\ (\ d\) (\ d {3} -) {2}\ d {3}) / Btn.onclick = function () {if (regexp.test (text.value)) {alert ('verification passed'); text.value= ";} else {alert ('verification failed');}} after reading this article, I believe you have a certain understanding of" sample analysis of regular expression matching URL, phone, mobile phone and mailbox in html ". If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!

Tags: Regular sample phone expression mailbox verification mobile phone analysis code article rule Zhong Chang also known as number finished text more concept pattern electronic Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS NVidia vpn Docker Linux