In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How do I use regular expressions to match empty tags in JavaScript? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.
For example
Wait
Regular pattern
/] *?)? >\ s*?/ig
Html=''+'\ nbaby girls'\ ngirls'\ n
'+'\ nfarmers'\ n
'+'\ n' +'\ n'ptn=/] *?)? >\ s*?/igs = html.replace (ptn,'') console.log (s)
Through online testing tools
If you consider removing the span without style
If you have span, stay.
Because in the default editor, span has no style and is not necessary.
Str=str.replace (/. [^] *) / ig, "$1")
Look at the position below first.
Zero width assertion
The next four are used to find things before or after certain content (but not including them), that is, they are used to specify a location like\ b, ^, $, which should meet certain conditions (that is, assertions). So they are also called zero-width assertions. It's best to give an example to illustrate:
Assertions are used to declare a fact that should be true. Matching continues in a regular expression only if the assertion is true.
(? = exp) is also called zero-width positive prediction antecedent assertion, which asserts that the position of its occurrence matches the expression exp. For example,\ b\ w + (? = ing\ b) matches the first part of a word ending in ing (except for ing), such as finding I'm singing while you're dancing. It matches sing and danc.
(?) A prefix is specified: a word enclosed in angle brackets (for example, it may be), followed by. * (any string), followed by a suffix (? =). Notice the\ / in the suffix, which uses the character escape mentioned earlier;\ 1 is a reverse reference, referring to the first set of captured content that matches the previous (\ w +), so that if the prefix is actually, the suffix is. The whole expression matches the content between and (again, excluding the prefix and suffix itself).
This interpretation
1 、
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.