Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js concatenate regex

const a = /a/
const b = /b/
// Concatenate two Regular Expressions with an OR |
const c = new RegExp( a.source + "|" + b.source );
// c --> /a|b/

"a".match(c)
// ["a", index: 0, input: "a", groups: undefined]
"b".match(c)
// ["b", index: 0, input: "b", groups: undefined]
"c".match(c)
// null
Comment

PREVIOUS NEXT
Code Example
Javascript :: Best way to execute js only on specific page 
Javascript :: silent keylogger browser 
Javascript :: jasmine sample code 
Javascript :: how to make a post request from axios 
Javascript :: how to console in node js 
Javascript :: javascript ip address 
Javascript :: javascript string concat vs + 
Javascript :: use map to loop through an array 
Javascript :: javascript remoe last character from string 
Javascript :: how assign custom date to input type date in javascript 
Javascript :: get second element with a class jquery 
Javascript :: set selected value of dropdown using formcontrol in angular 
Javascript :: react sign in with linkedin 
Javascript :: classic asp get json from file 
Javascript :: js search in object 
Javascript :: react mid senior dev interview questuions 
Javascript :: how to export module in node js 
Javascript :: see vuex values production console 
Javascript :: webpack build watch 
Javascript :: javascript convert array to matrix 
Javascript :: jspdf 
Javascript :: how to test if an element has a class in testing library 
Javascript :: Get the url and parse or url.parse deprecated solved 
Javascript :: angular random number between 1 and 10 
Javascript :: javascript catch specific error 
Javascript :: flutter http get json to map 
Javascript :: how to read json file with file input html 
Javascript :: react bootsrap color picker 
Javascript :: fs flies in dir 
Javascript :: window scroll up 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =