<script> var str = "The best things in life are free"; var patt = new RegExp("e"); var res = patt.test(str); </script>
<script> const str = 'hello world!'; const result = /^hello/.test(str); console.log(result); // true </script>The test() method executes a search for a match between a regular expression and a specified string.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
- Uncaught TypeError: Illegal invocation
- Uncaught TypeError: $(...).summernote is not a function
- How to open modal after redirect
- Input type file styling
- Uncaught SyntaxError: Identifier 'CODE' has already been declared
- How to fixed bootstrap navbar at top on scroll
- Uncaught TypeError: Assignment to constant variable
- Short-circuits conditionals