TextPad “find in files” not matching on simple OR

2019-07-17 14:15发布

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".

enter image description here

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

标签: regex textpad
5条回答
孤傲高冷的网名
2楼-- · 2019-07-17 14:51

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

summer\|winter

查看更多
贪生不怕死
3楼-- · 2019-07-17 14:52

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]
查看更多
我命由我不由天
4楼-- · 2019-07-17 14:55

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

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

查看更多
可以哭但决不认输i
5楼-- · 2019-07-17 14:56

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

查看更多
Emotional °昔
6楼-- · 2019-07-17 15:08

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

查看更多
登录 后发表回答