marky
marky

Reputation: 5068

Notepad++ RegEx search - Find n occurrences of a character anywhere in a line

Given these lines in a text file:

John|Doe |4 |1|1 |1 |0 |sometext||3251076 
Mary|Jane |5 |1|2 |1 |1 |||3251030 Henry|Smith |6 |1|1 |1 |0 |text||3254212 
Sue|Anderson.|1 |1|1 |0 |0 |||4080010

I need to find the line that has more than 9 pipe characters.

Using a RegEx building tool at regexr.com I only can do this:

^[|]{3,}$

Which finds the 2 instances of 3 successive pipes in the online tool, but doesn't work at all in Notepad++. That's the closest I can get.

As far as building the regex in the online tool I need to add something that specifies to find the pipe anywhere in the line, instead of successive instances of the pipe.

Translating that to Notepad++, however, looks to be another matter...

Upvotes: 1

Views: 1713

Answers (1)

Toto
Toto

Reputation: 91385

This one works:

^(?:[^|\r\n]*\|){9,}.*$

This matches 0 or more NON pipe followed by a pipe, 9 or more times.

Upvotes: 3

Related Questions