The last decade has seen the beginning of what could become a methodological revolution in the fields of Arabic and Islamic Studies with the appearance of large collections of digitized classical Arabic texts. The aim of this article is to show that open-source tools can be developed by researchers to utilize the existing collections of digital texts more comprehensively. We will focus on the possibilities that easy-to-learn but powerful programming languages like Python offer for advanced search operations. The authors of this article use Python for historical research with early Islamic texts and have built an open-source textual analysis toolkit, released under the name Jedli. In the second part of this article, we will present the basic building blocks of the Jedli program with special focus on its context search function. We hope the ideas presented in this article can serve as an inspiration for other researchers to build more complex tools for textual analysis.