The example of this article describes the method of JS regular interception of the content between two strings and the content before and after the string. Share it with everyone for your reference, the details are as follows:
1. js intercepts the content between two strings:
var str = "aaabbbcccdddeeefff"; str = str.match(/aaa(\S*)fff/)[1]; alert(str);//结果bbbcccdddeee
##2. js intercepts the content in front of a certain string:
var str = "aaabbbcccdddeeefff"; tr = str.match(/(\S*)fff/)[1]; alert(str);//结果aaabbbcccddd
var str = "aaabbbcccdddeeefff"; str = str.match(/aaa(\S*)/)[1]; alert(str);//结果bbbcccdddeeefff