HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <p>Click the button to do a search of 2 and 25 in characters of a string.</p> <button onclick="myFunction()">Click me</button> <p id="point"></p> <script> function myFunction(){ var str = "2 25 255"; var pattern = /25?/g; var result = str.match(pattern); document.getElementById("point").innerHTML = result; } </script> </body> </html>
OUTPUT
×

Save as Private