Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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>
Advertisements
