In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about how the $1 copyright 9 attribute in js regular expressions returns the result of a sub-match. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Function: $1 music 9 stores the matching results of the nine most recent regular expressions in the regular expression, which are arranged in the order in which the submatches appear.
Basic syntax RegExp.$n
Note: these properties are static, and RegExp is added to all uses except for the second parameter in replace that omits RegExp.
Case study: demo1
The code is as follows:
/ / create a string to match
Var objStr= "this is my cell phone number 13100000000"
/ / create a regular expression to match the mobile phone number
Var re=/ (13) (/ d) (/ d {8}) /; / / the regular expression can match the mobile phone number with the number 11 starting with 13 and the flag with () as the submatch.
[xss_clean] (objStr.replace (re, "$1 $2*")); / / replace the string according to the contents of the regular expression for privacy
/ / if the second sub-match result, that is, the third digit in the mobile phone number is less than or equal to 3, then the mobile phone number is the Unicom number, otherwise it is the number of other operators
If (RegExp.$2
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.