Horje
js store regex in variable and combine Code Example
js store regex in variable and combine
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




Javascript

Related
placeholder text disappear when click in react Code Example placeholder text disappear when click in react Code Example
vue implode array Code Example vue implode array Code Example
how to manage logging using winston for production and development in node js "github" Code Example how to manage logging using winston for production and development in node js "github" Code Example
enforcefocus select2 modal Code Example enforcefocus select2 modal Code Example
js concatenate regex Code Example js concatenate regex Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9