0

Is it possible to not limit the upper value of a regex range for the repetition of a character? I'm not sure if this is possible. I'm using infinity as a placeholder in this example:

let lowerLimit = 2; // Or any value
let regex = RegExp ("[\n]{" + lowerLimit + ",Infinity}", "g");
JosephTLyons
  • 2,075
  • 16
  • 39

1 Answers1

1

Just take a comma with no value as max quantifier.

{n,} 

With your code

let lowerLimit = 2; // Or any value
let regex = RegExp ("[\n]{" + lowerLimit + ",}", "g");
//                                          ^^
Nina Scholz
  • 376,160
  • 25
  • 347
  • 392