TextPad “find in files” not matching on simple OR

2019-07-17 14:36发布

问题:

I've tried searching files for either/or word scenarios and they always fail to find any results in TextPad.

An example is trying to find something like summer|winter where I want to return any files that contain either the word "summer" or the word "winter".

This regex works fine in other programs like Notepad++. Why doesn't it work in TextPad?

回答1:

Textpad.com online release notes says that they fixed a bug in 7.0.7 related to this where they:

Reject "|" as a regular expression



回答2:

Textpad seems to use slightly unusual syntax for regex 'finds'. Read the TextPad help file for the details. Here is an example for finding a IPv4 number. It works with textpad v4.7.3 'Find' and 'Find in files'

[^0-9][0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}[^0-9]


回答3:

On older versions It works with: \(summer\|winter\),

Escape (alt+92 backslash) before every paren and "or" carácter.



回答4:

Using Textpad 6.x, I have to escape the or operator and it works:

summer\|winter



回答5:

Try (summer)|(winter): it could be reading it as summe(r|w)inter.



标签: regex textpad