Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use JS to hide the mobile phone number in the string

Shulou Source: shulou.com Published: 2022-06-03 13:31:18 11月14日 Update

This article will explain in detail how to use JS to hide the mobile phone number in the string. Xiaobian thinks it is quite practical, so share it with you for reference. I hope you can gain something after reading this article.

var regx = /(1[3|4|5|7|8][\d]{9}|0[\d]{2,3}-[\d]{7,8}|400[-]? [\d]{3}[-]? [\d]{4})/g; var str = "13250203010"; var strresult = matchPhoneNum(str,regx);console.log(strresult);function matchPhoneNum(str,regx){var phoneNums = str.match(regx);for(var i= 0;i

Tags: Mobile phone article number character string mobile number mobile number more good practical content article knowledge reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info NVidia Xiaomi MySQL Docker