This post details how to include variables in regular expressions, but it only shows how to include one variable. I am currently using the match function for a regular expression to find the string in between a leading and trailing string. My code is below:
array = text.match(/SomeLeadingString(.*?)SomeTrailingString/g);
Now, how could I construct a regular expression that has the same functionality as this, but rather than having the two strings I'm using actually in the expression, I would like to be able to create them outside, like so:
var startString = "SomeLeadingString"
var endString = "SomeTrailingString"
So, my final question is, how can I include startString and endString into the regular expression that I listed above so that the functionality is the same? Thanks!