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
The answer is yes! You have to initialize the variable under the RegExp class:
var lower = new RegExp(/--RegexCode--/);
var upper = new RegExp(/--RegexCode--/);
hence, regex can be dynamically created. After creation:
"sampleString".replace(/--whatever it should do--/);
Then you can combine them normally, yes.
var finalRe = new RegExp(lower.source + "|" + upper.source);