In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
JavaScript Advanced Programming (3rd Edition) Notes-Chapter 5-RegExp Types
There are two ways to define regular expressions
1. Define regular expressions in literal form:
ver expression = /patterns/flags;
patterns: can be any simple or complex regular expression
flags:
g: global
i: means case insensitive
m: indicates multi-row mode, which continues to find the next row when it reaches the end of one row
var patterns1 = /at/g;//matches all instances of "at" in characters var patterns2 = /[bc]at/i;//matches all "bat" or "cat", case insensitive var patterns3 = /.at/gi;//matches all combinations of three characters ending in "at", case insensitive
All metacharacters used in patterns must be escaped, metacharacters in regular expressions include: ( [ { \ ^ $| ) ? * + . ] }
var patterns4 = /\[bc\]at/i;//matches the first "[bc]at", case insensitive
2. Define a regular expression with RegExp constructor, which accepts two parameters (patterns,flags)
var patterns2 = new RegExp("[bc]at","i");//Same as var patterns2 = /[bc]at/i;
Also use RegExp to escape metacharacters and double escape
vqr patterns 4 = new RegExp("\\[bc\\]at","i"); Same as var patterns4 = /\[bc\]at/i;
These two methods create different regular expressions. Regular expression literals always share a RegExp instance, and each new RegExp instance created using a constructor is a new instance
var re = null, i; for(i=0;i
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.