I am trying to pull out information directly from a div which has more than 25 pages of repeating information. For instance, the information would look something like this:
var first = "Your Name is: name Your Age is: age Your email is: email....Your Name is: name Your Age is: age Your email is: email....Your Name is: name Your Age is: age Your email is: email....Your Name is: name Your Age is: age Your email is: email....Your Name is: name Your Age is: age Your email is: email...."   I want to extract multiple occurrences of the substrings in between "Your Name is:" and "Your Age is:", as well as for age, email.
var name = "Your Name is:"  var age = "Your Age is:"  var re = new RegExp(name,'gi');  var re2 = new RegExp(age,'gi');      var result = new Array();  while (re.exec(first){  results.push(re.lastIndex);}  var result2 = new Array();  while (re2.exec(first){  results.push(re2.lastIndex);}    var info = first.substring(  first.lastIndexOf(name) + 1,  first.lastIndexOf(age)  );      <span>{info}</span>  I want info to loop and display all values once. Help.
https://stackoverflow.com/questions/66993315/display-all-occurrences-between-two-substrings-within-a-string-in-react April 08, 2021 at 03:58AM 
没有评论:
发表评论