I want to include a value of variable into regex pattern.
The following code is the familiar.
var regex = /(.)\1{2}/;
I want to do like The following.
var number = 2;
var regex = /(.)\1{number}/
How to do that ?
I want to include a value of variable into regex pattern.
The following code is the familiar.
var regex = /(.)\1{2}/;
I want to do like The following.
var number = 2;
var regex = /(.)\1{number}/
How to do that ?