|This is a topic from the SwordSearcher Bible Software help file.|
Regular Expression Search
|Top Previous Next|
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.
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 Regular-Expressions.info 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 text 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 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.