본문 바로가기

카테고리 없음

n*

728x90

The n* quantifier matches any string that contains zero or more occurrences of n.




<!DOCTYPE html>

<html>

<body>


<p>Click the button to do a global search for an "l", followed by zero or more "o" characters.</p>


<button onclick="myFunction()">Try it</button>


<p id="demo"></p>


<script>

function myFunction() {

    var str = "Hellooo World! Hello W3Schools!"; 

    var patt1 = /lo*/g;

    var result = str.match(patt1);

    document.getElementById("demo").innerHTML = result;

}

</script>


</body>

</html>


l,looo,l,l,lo,l

728x90