TextPad “find in files” not matching on simple OR regex

十年热恋 提交于 2019-12-11 01:36:10

问题


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.



来源:https://stackoverflow.com/questions/16365795/textpad-find-in-files-not-matching-on-simple-or-regex

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!