I my application I am using below regex for pattern matching.
Original Pattern :
/(\w+\.){2,}/ig
Above pattern added in one array. Since this pattern has comma ( , ) after 2, creating problem in some environment.
As we know below concept in regex :
{n} - matches n times
{n, m} - matches at least n times, but not more than m times
So I have removed comma present after 2, because in above pattern no value exist after comma.
Pattern after removing comma :
/(\w+\.){2}/ig
As per above change i have resolved environment problem which i was facing earlier.
So here, I just wanted to know that by removing comma after 2 creates any problem while matching, for above given case.
{2}means match if it appears exactly 2 times, and{2,}means 2 times or above. Depending on the usage, this may or may not matter.For example, if you want to validate whether the string contains 2 or more
\w+\., then the comma doesn’t matter. However, if you want to replace those 2 or more\w+\.with something else, the comma will affect the result.