Regular expression pattern match using a variable?

I can test for a fixed pattern using a regular expression. e.g.

DOpus.Output((("asdfg".match(/sdf/)) ? "True" : "False")); // = True
DOpus.Output((("asdfg".match(/\w{5}/)) ? "True" : "False")); // True

Is there a way to do the same thing with a variable pattern ?

If we're talking about JScript: Regular expressions - JavaScript | MDN shows how near the top.

Excellent. Thanks for the pointer. :+1: