<html>
<script language="javascript" type="text/javascript">
// Use regular expression pattern to perform a search on the string and return the result containing the search as an array
var objStr=new String("Yue I love you till the end of my life!");
var re=//wo(/w+)?/g;//This expression is used to match a character represented by /w. The second character is o, followed by one character or multiple characters + indicates the number of times the previous character matches, global match
var arr=(re);//Call the match method to match the string and return the array if there is no result, return as null
("Before matched string:"+objStr+"<br>");//Output the string before matched string:
if(arr!=null){//If the match can be successful, the arr array is not empty, and the loop output result
for(var i=0;i<;i++){
("<li>"+arr[i]);
}
}
</script>
</html>