0

The following command will highlight 4 a's instead of 3 a's. I just want to match for no more than 3 a's. Is there anything wrong with the regex that I use?

pcregrep --color 'a{0,3}' <<< aaaabbb
user1424739
  • 11,937
  • 17
  • 63
  • 152
  • Are you sure it's not highlighting three 'a's then one 'a'? – Ken Y-N Jan 16 '19 at 23:50
  • Yes, it is. I didn't realize it. `$ pcregrep --color=always 'a{0,3}' <<< aaaabbb|xxd 00000000: 1b5b 313b 3331 6d61 6161 1b5b 3030 6d1b .[1;31maaa.[00m. 00000010: 5b31 3b33 316d 611b 5b30 306d 6262 620a [1;31ma.[00mbbb.` – user1424739 Jan 17 '19 at 00:36

0 Answers0