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");
joe_04_04
  • 2,015
  • 14
  • 34

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
  • 351,820
  • 24
  • 303
  • 358