@russian-dima so you can’t just put a variable as you wanted.
You have to use RegExp object one way or another, as Hello mentioned.
You can read more about it here:
and here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp
and here: