开发者

Extended Search

So I've got a big text file which looks like the following:

text;text;text;text;text - 5 words
text;text;text;text;text;text - 6 words
text;text;text;text;text;text;text - 7 wor开发者_如何学Cds

How i can search lines with 6, 7,... words?

I try search with (.*);(.*);(.*);(.*);(.*);(.*); but not work :(


Note: Notepad++ does choke on my existing regex, but the OP adapted it to suit his need, see the comments for more.

First of all, you should be doing a regular expression search, not an extended search.

Here's the regex. Basically you match the first 5 words, then match at least one more after the first 5 (if you don't need to match the last semicolon, take out the ;?):

(.*);(.*);(.*);(.*);(.*)(;(.*))+;?

(You cannot use (.*)(;(.*)){5,} as Notepad++ doesn't support that syntax.)


Don't abuse the *. If you are trying to match at least one character, .+ is less ambiguous. In fact, if ; is the separator, you can try [^;]+ to be even more pedantic.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜