Nodejs Regex Concatenate String

I want to concatenate two strings to make a regular expression so I can have different prefix but same pattern at the back of the string.

If notice, must use doubleĀ  back slashes if the regular expression uses back slash. Example instead of \d must use \\d.

Code

Output

nodejs regex concatenate strings demo output
nodejs regex concatenate strings demo output

Demo

You can test the Regex Concatenate Strings here.