Match any string with p at the end of it.



To match any string with p at the end of it with JavaScript RegExp, use the p$ Quantifier.

Example

<html>    <head>       <title>JavaScript Regular Expression</title>    </head>    <body>       <script>          var myStr = "Welcome to our website! Welcome";          var reg = /me$/g;          var match = myStr.match(reg);                    document.write(match);       </script>    </body> </html>
Updated on: 2020-06-23T08:40:30+05:30

152 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements