text: In the past, most of the applications are forward pre search. In other words, there are specific content restrictions on the right side of the search content, such as the following example:
  var reg3 = /Memory\:\s+(.*(?=\;OS\:))/gim;
  str3.match(reg3);
  alert(RegExp.$1); // The result is 2G
  (.*(?=\; OS \:) is a typical forward pre search, only the content on the right side is “; OS: “will be matched.
  But now to achieve the effect, the content of the left side is fixed, not the right side. However, JavaScript does not support reverse pre search. I believe that careful friends have found that the above example has already achieved this goal (the memory in front is limited to the content on the left). Here is another example:
  var str = ‘<img src=”” >’;
  var reg1 = /(\<img)(.*(?=(http|https)\:\/\/))((http|https)\:\/\/[^\/]*)/gim;
  str.match(reg1);
  alert(str.replace(RegExp.$4,”));
  So is there reverse pre search? The answer is yes, but the reality is cruel. I have consulted some materials. What is the reverse pre search mode mentioned above<= Or? <! For guidance. Unfortunately, JavaScript is not supported. It has been supported in higher versions of Java, so we wrote the following test program (jre1.6.0)_ 03）：
  import java.util.regex.Pattern;
  public class RegExpTest {
  public static void main(String[] args){
  Pattern p = Pattern.compile(“((?<=\\<img.*(?=(http|https)))(http|https))”);
  Matcher matcher = p.matcher(“<img src=””/>”);
  System.out.println(matcher.matches());
  }
  }
  There should be no problem with the program itself, but the running result is as follows:
  Exception in thread “main” java.util.regex.PatternSyntaxException: Look-behind group does not have an obvious maximum length near index 27
  ((?<=\<img.*(?=(http|https)))(http|https))
  I googled for a long time, and the only result I got was a different way of writing. Hope to see this article friends, if you have achieved this effect, be sure to leave a message.
  In addition, when I look at the document, I see?: Guided regular expression, the above said is “matching does not store”, can’t think of its solution. I feel that the code is real. Let’s take a look at it
  Var reg2 = / (client name (?): (1) /;
  str2.match(reg2);
  alert(RegExp.$1); // Client name
  alert(RegExp.$2); // Empty string
  //Not used?:
  Reg2 = / (client name) /;
  str2.match(reg2);
  alert(RegExp.$1); // Client name
  alert(RegExp.$2); // call
  Agile development thought says: code is the best document. Give me an excuse, ha ha.