Tip: search for a string that spans multiple lines
The searching tip presented afterwards applies to any application that allows you to use regular expressions when finding strings within a file such as PyCharm:
PyCharm allows you to search your source code with regex
The difficulty is that sometimes the string spans multiple lines and you want to match it no matter where the newline(s) happens in the string.
If we use the simple search query without tokens "turned into a democracy", we will only match the first occurrence of the given string, as shown in the following regex101.com demo:
You can also try it out with PyCharm or any other application that allows regex-based search:
Reference
This blog post is based on search-ebooks README (personal project I'm working on for searching ebook contents and metadata of various formats).
Comments
Post a Comment