Regular expression that checks for the presence of a repeating pattern

2

How do I make a regular expression saying that this has to repeat exactly a tot of times? For example, I would like to check if a line from a file contains this pattern |1_CHAR exactly 8 times. By now, it is possible for example to say that the character type has to be espaço , or o , or * ?

    
asked by anonymous 17.11.2014 / 15:58

1 answer

2

You can use {n} for something that repeats a fixed number of times. For example, the regular expression a{8} recognizes a string of 8 characters a .

In addition, it also has {n,m} for "n to m replicates" and {,m} and {n,} for "up to m replicates and" at least n replicates ", respectively.     

17.11.2014 / 16:13