Deon
Deon

Reputation: 3

How to count specific characters in all lines in notepad ++

I need to count the number of | symbol and make sure that each line contains 6 of them. How do i do it in notepad++ to highlight the lines that contains less or more than 6 | symbol?

For example:

1.The F in TGIF means?|Fish|Fort|Friday|Father|Fan|3

2.The T in TGIF means?|Thank|Tooth|Tank|Tiger|1

3.The G in TGIF means?|Gundam|Go-pro|Genetics|Google|God|Goldfish|5

Line 2 and 3 need to be highlighted to inform me that there is more/less than 6 of the symbol |

Upvotes: 0

Views: 4037

Answers (1)

Casimir et Hippolyte
Casimir et Hippolyte

Reputation: 89557

you can try this pattern that checks in a lookahead that the line doesn't contain exactly 6 pipes:

^(?!(?:[^|\n]*\|){6}[^|\n]*$).+

Upvotes: 3

Related Questions