Regular Expression Search

<< Click to Display Table of Contents >>

Navigation:  Searching and Indexing > Search Bible Dialog >

Regular Expression Search

A RegEx (Regular Expression) Search is a specialized search type on the Search Bible dialog. RegEx search is a highly advanced search type. Most users can skip this section.


If you do not understand RegEx, don't worry! Just skip this section and move on. The Normal Search SwordSearcher provides is all the power 99.99% of users need.



Sample Search Bible dialog showing RegEx Search page

Sample Search Bible dialog showing RegEx Search page


A Regular Expression (usually called RegEx) is a special way of describing a search pattern, and can include positions (anchors), character types, repetition, quantification, etc. A Regular Expressions tutorial is outside the scope of this manual. For an introduction to RegEx, see on the Web.


Certain kinds of searches can only be done with a RegEx.  For example, you can find all of the verses that begin with the word "Oh" with the following RegEx search:




^ means "start of line" (in a SwordSearcher RegEx, a "line" is the same as "verse"). oh matches the letter sequence oh. \b means "word boundary," which can be a space or punctuation or any other non-letter character.


Remove pre- and post-scripts from verses is important because it can affect anchor matching in the search. The "pre and post" scripts are the titles that normally appears before the first verse in a printed Bible, like "A Psalm of David, when he fled from Absalom his son." in Psalm 3:1; or the colophon after the last verse, like "Written to the Romans from Corinthus, and sent by Phebe servant of the church at Cenchrea." in Romans 16:27. SwordSearcher includes these in the verse proper, but normally when specifying anchors in a RegEx search, you would want these text strings excluded.


Technical information: SwordSearcher uses Perl-style RegEx, specifically the PCRE library.


When typing a RegEx, look for a "red dot" to the right of the text entry area.  When the red dot appears, the RegEx is incomplete or invalid. You can hold your mouse pointer over the red dot to see an explanation of the error.