The js regular expression matches the content between two specific characters
In this issue, the editor will bring you the content about js regular expression matching between two specific characters. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
1. Js intercepts the content between two strings:
Var str = "aaabbbcccdddeeefff"; str = str.match (/ aaa (\ S*) fff/) [1]; alert (str); / / result bbbcccdddeee
2. Js intercepts the content in front of a string:
Var str = "aaabbbcccdddeeefff"; tr = str.match (/ (\ S*) fff/) [1]; alert (str); / / result aaabbbcccddd
3. Js intercepts the content after a certain string:
Var str = "aaabbbcccdddeeefff"; str = str.match (/ aaa (\ S*) /) [1]; alert (str); / / result bbbcccdddeeefff above is the js regular expression that Xiaobian shared matches the content between two specific characters. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.