开发者

Notepad++ extented search

开发者 https://www.devze.com 2023-02-06 05:49 出处:网络
I search lines with (.*);(.*);(.*);(.*);(.*);(.*);(.*);(.*);(.*) formula. (9 characters) But search with 10 characters or more not work :(

I search lines with (.*);(.*);(.*);(.*);(.*);(.*);(.*);(.*);(.*) formula. (9 characters) But search with 10 characters or more not work :(

Any kn开发者_运维技巧ow why can't search?


I entered the line 1;2;3;4;5;6;7;8;9;0;q;w;e;r;t;y;u;i;o;p in Notepad++ and tried the following searches:

  • (.*);(.*);(.*);(.*);(.*);(.*);(.*);(.*);(.*) (9 groups): matches.
  • (.*);(.*);(.*);(.*);(.*);(.*);(.*);(.*);(.*);.* (10 groups without parentheses around the last): matches.
  • (.*);(.*);(.*);(.*);(.*);(.*);(.*);(.*);(.*);(.*) (10 groups): doesn't match. Notepad++ tells me it can't find the text, although the text is quite clearly there.

I'd guess that this is because Notepad++ doesn't support any more than 9 backreferences (\1 to \9 in the replacement string), and so it doesn't let you have any more than 9 parenthesised groups. (I am struggling to find any documentation to back up my claim, however.)

If you don't need the values matched (e.g. you're not replacing text), then you can always drop the parentheses, as in the second example above.

I can only guess at a possible reason why 10 or more backreferences are not allowed: what should \10 represent? Should it be the 10th backreference, or the 1st backreference followed by 0?

0

精彩评论

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