Is it possible to combine regular expressions in javascript.
For ex:
var lower = /[a-z]/;
var upper = /[A-Z]/;
var alpha = upper|lower;//Is this possible?
ie. can i assign regular expressions to variables and combine those variables using pattern matching characters as
we do in regular expressions
The answer is yes! You have to initialize the variable under the RegExp class:
hence, regex can be dynamically created. After creation:
Then you can combine them normally, yes.