

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Which is the JavaScript RegExp to find any alternative text?
To match any of the specified alternatives, follow the below-given pattern −
(foo|bar|baz)
Example
You can try to run the following code to find any alternative text −
<html> <head> <title>JavaScript Regular Expression</title> </head> <body> <script> var myStr = "one,one,one, two, three, four, four"; var reg = /(one|two|three)/g; var match = myStr.match(reg); document.write(match); </script> </body> </html>
- Related Questions & Answers
- Is their any alternative to HTML5 iframe srcdoc?
- Is there any alternative for CONCAT() in MySQL?
- With JavaScript RegExp how to search a string for text that matches regexp?
- Find digit with JavaScript RegExp.
- Is there any alternative solution for static constructor in java?
- Is there any alternative for OpenCV imshow() method in Java?
- Find digits between brackets in JavaScript RegExp?
- How to find character between brackets in JavaScript RegExp?
- Alternative shuffle in JavaScript
- How to find a character, not between the brackets in JavaScript RegExp?
- With JavaScript RegExp find a character except newline?
- Find a new line character with JavaScript RegExp.
- Find a form feed character with JavaScript RegExp.
- What is the role of exec method in JavaScript RegExp?
- What is the role of global RegExp property in JavaScript?
Advertisements