admin管理员组文章数量:1124530
In a JetBrains IDE (such as IntelliJ or RubyMine), how can I do a "Find in Files" that matches a string that spans two consecutive lines?
For example, I want to search for files in my project that have a line ending with the string "You can" immediately followed by a line beginning with the string "begin paying". As in the middle two lines of this sample:
<p>
We are pleased to inform you that registration has been completed! You can
begin paying your ...
</p>
In a JetBrains IDE (such as IntelliJ or RubyMine), how can I do a "Find in Files" that matches a string that spans two consecutive lines?
For example, I want to search for files in my project that have a line ending with the string "You can" immediately followed by a line beginning with the string "begin paying". As in the middle two lines of this sample:
<p>
We are pleased to inform you that registration has been completed! You can
begin paying your ...
</p>
Share
Improve this question
asked 2 days ago
Jon SchneiderJon Schneider
27k24 gold badges151 silver badges180 bronze badges
1 Answer
Reset to default 0In the Find in Files window, ensure that regex search (the .*
button) is enabled, and then add the string \s*\n\s*
between your two search terms, e.g.:
You can\s*\n\s*begin paying
The two \s*
match whitespace at the end of the first line and the beginning of the second line, respectively, so that matches will be found even if the second line of code is indented (and/or if there is whitespace at the end of the first line).
本文标签: How to search for a string spanning lines (across consecutive lines) in JetBrains IDEsStack Overflow
版权声明:本文标题:How to search for a string spanning lines (across consecutive lines) in JetBrains IDEs? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736634734a1945851.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论