Reputation: 43833
If I have this hardcoded regex
/^ *\d+(?:\.\d+)+ *Country/
How can I change it so that Country
comes from a string variable, and another variable would be /^ *\d+(?:\.\d+)+ */
, then somehow concatenate it so it becomes
/^ *\d+(?:\.\d+)+ *Country/
?
Thanks
Upvotes: 0
Views: 43
Reputation: 521
Maybe this helps
var re = new RegExp('^ *\\d+(?:\\.\\d+)+ *'+ country);
Upvotes: 2