# Simple Searches

To conduct a quick search within the current Bible or commentary module, the Search Bar in the Sidebar should usually be adequate. Click either in the menu bar Edit->Search or in the Sidebar Modules->Search to access it.

## The Search Bar

The Search Bar

The Search Dialog consists of the following parts:

- Search Key Entry box

- Search Module Selector

- Search Type Selector

- Search Options Checkbox

- Search Scope Selector

## Search Key Entry Box

Allows entry of the key for which you would like to search. The search key can be a word, part of a word, several words, a phrase, or a regular expression depending on the type of search selected. When the search key is entered and all other selections in the search dialog are complete, click the Find button to begin the search.

This search uses the optimized search method (see next section) if the module has previously been indexed, so bear in mind the additional syntax required to do multi-word searches (e.g. +FirstWord +SecondWord).

## Search Module Selector

Allows selection of which modules you would like to search. Select Bible to search Bible versions or Commentary to search commentaries. Only the currently active module will be searched.

## Search Type Selector

Allows selection of the type of search. There are three search types available:

Multi word

  This type will match any verse that has all the words in the search key, regardless of where they appear in the verse.

Regular expression

  This search uses a regular expression as a search key. A regular expression is a pattern used to match a string of text. A regular expression can be used to find verses with words that match a particular pattern. For example the regular expression `\ A[a-z]*iah` will match verses that contain the words Aiah, Ahaziah, Athaliah and Amariah.

  A complete discussion of regular expressions is beyond the scope of this manual, but more information can be found in the grep man page.

Exact phrase

  This type will match the search key exatly as entered. If the search key is `it is good`, this search would match a verse which contains "it is good," but would not match a verse which contains " good, and doeth it not, to him it is sin."

## Search Options Checkbox

Allows selecting of search options. The only available option is Match case. Check this box to make the search case sensitive.

## Search Scope Selector

Allows defining the range within the specificed module that will be searched. There are three search scopes available:

No scope

  This button causes the search to to include the entire module.

Use bounds

  Selecting this button produces two dropdown selector boxes marked Lower and Upper. Select the first book to search in the Lower box and the last book to search in the Upper box. The search will begin with the Lower book and end with the Upper book and include all books in between.

  Chapter and verse numbers can be entered into the search bound boxes as well to further narrow the search.

Last search

  Select this button to do a new search including only the verses returned as a result of the last search. Use this with a new search key to narrow the search further.

# Advanced Searches

More complicated searches might require the use of the advanced search functions, found under Edit->Advanced Search.

## The Advanced Search Dialogue

The Advanced Search Dialog

In Advanced Search, much more complex queries can be constructed, involving custom search ranges, custom lists of modules over which to search, regular expression matching (see next section), and attribute-based searches such as are found in footnotes or Strong's Hebrew and Greek dictionary references.

The default search is multi-word, a somewhat slow and blunt search through module text. Also available is an optimized search based on the Lucene indexing and search library. A web search will provide several references to the syntax needed to put to use the power of an optimized Lucene search. In order to use the optimized search, the index must be constructed beforehand: Please see the preceding section on the Module Manager regarding the Maintenance functions, including indexing.

By default, two standard search ranges are defined, for Old and New Testament; you may wish to define others for e.g. "Gospels" or "Paul's Epistles". One (fake) custom module list is present, as a placeholder to make obvious what is required: Since it cannot be known what modules a user will install, no real content for such a module list can be assumed. If desired, new searches can be performed across only the current results of the previous search. Any modules may be searched, including general books and even dictionaries, in any combination.

Note the tooltip in the screenshot above, for Attributes search. This qualifier is used to perform searches on attributes that are carried with verses, instead of verse content proper, such as footnote content or Strong's Hebrew and Greek references. If this button is selected, specific attribute qualifiers must be made in the Attribute Search tab, at the right end of the tab set. Strong's references are identified with a leading "H" or "G" and the numeric Strong's identifier. Thus, a search of KJV for Strong's Greek #140, using "G140", will return the single result of Matthew 12:18.

The "Find" button also stops an in-progress search, as its tooltip indicates.

Changes to some of the settings (e.g. scope of search, searched modules, etc.) in Advanced Search will affect the simple search via the side pane but not vice versa.

# Search Syntax using Regular Expression

Regular expression searches provide a way to do simple or complex searches for strings that match a pattern or set of patterns (branches) separated by vertical bars "|". While a pattern can be built to look for a word or phrase, a simple pattern that consists of a word does not look for only that word but for any place the string of letters that make that word are found. A search for "right" will return verses that contain the word "right", but also "righteous", "righteousness", "unrighteous", "upright" and even "bright". A search for "hall not" is not a search for "hall" AND "not" but for the string "hall not" with a space between the second "l" and the "n". The search for "hall not" will find occurrences of "shall not".

The power of Regular Expressions is in the patterns (or templates) used to define a search. A pattern consists of ordinary characters and some special characters that are used and interpreted by a set of rules. Special characters include .\[^*$?+. Ordinary (or simple) characters are any characters that are not special. The backslash, "\", is used to convert special characters to ordinary and ordinary characters to special.

Example: the pattern "i. love\." will find sentences that end with "his love" or "in love" or "is love" followed by a period. The first period in "i. love\." is a special character that means allow any character in this position. The backslash in "i. love\." means that the period following it is not to be considered a special character, but is an ordinary period.

## Rules for Regular Expression Search Requests

- . The period matches any character.

- * The asterisk matches 0 or more characters of the preceding: set, character or indicated character.

- + The plus sign matches 1 or more characters of the preceding: set, character or indicated character.

- ? The question mark matches 0 or 1 character of the preceding: set, character or indicated character.

- [ ] Square brackets match any one of the characters specified inside [ ].

- ^ A caret as the first character inside [ ] means NOT.

- ^ A caret beginning a pattern anchors the beginning of a line.

- $ A dollar at the end of a pattern anchors the end of a line.

- | A vertical bar means logical OR.

- ( ) Parentheses enclose expressions for grouping. Not supported!

- \ A backslash can be used prior to any special character to match that character.

- \ A backslash can be used prior to an ordinary character to make it a special character.

### The Period

The Period "." will match any single character even a space or other non-alphabet character. s.t matches sit, set, sot, etc., which could be located in sitting, compasseth and sottish b..t matches boot, boat and beat foot.tool matches footstool and foot tool

### The Asterisk

The asterisk "*" matches zero or more characters of the preceding: set, character or indicated character. Using a period asterisk combination ".*" after a commonly found pattern can cause the search to take a very long time, making the program seem to freeze. be*n matches beeen, been, ben, and bn which could locate Reuben and Shebna.

### The Plus Sign

The Plus Sign "+" matches one or more characters of the preceding: set, character or indicated character. Using a period and plus sign combination ".+" after a commonly found pattern can cause the search to take a very long time, making the program seem to freeze. be+n matches beeen, been and ben, but not bn.

### The Question Mark

The Question Mark "?"matches zero or one character of the preceding: set, character or indicated character. be?n matches ben and bn but not been. trees? matches trees or tree.

### The Square Brackets

The Square Brackets "[]" enclose a set of characters that can match. The period, asterisk, plus sign and question mark are not special inside the brackets. A minus sign can be used to indicate a range. If you want a caret "^" to be part of the range do not place it first after the left bracket or it will be a special character. To include a "]" in the set make it the first (or second after a special "^") character in the set. To include a minus sign in the set make it the first (or second after a special "^") or last character in the set. s[eia]t matches set, sit, and sat, but not sot. s[eia]+t matches as above but also, seat, seet, siet, etc. [a-d] matches a, b, c, or d. [A-Z] matches any uppercase letter. [.;:?!] matches ., ;, :, ?, or ! but not a comma. [ ]^-] matches ] or ^ or -

### The Caret first in Square Brackets

If the Caret is the first character after the left bracket ("[^") it means NOT. s[^io]t matches set, sat, etc., but not sit and sot.

### The Caret as Start of Line Anchor

If the Caret is the first character in a pattern ("^xxx") it anchors the pattern to the start of a line. Any match must be at the beginning of a line. Because of unfiltered formatting characters in some texts, this feature does not always work, but may if a few periods are placed after the caret to account for the formatting characters. ^In the beginning matches lines that start with "In the beginning". (May need to use: ^.....In the beginning)

### The Dollar Sign as End of Line Anchor

If the Dollar Sign is the last character ("xxx$") in a pattern it anchors the pattern to the end of a line. Any match must be at the end of a line. Because of unfiltered formatting characters in some texts, this feature does not always work, but may if a few periods are placed before the dollar sign to account for the formatting characters. Amen\.$ matches lines that end with "Amen." (May need to use Amen\....$, Amen\..........$, or even Amen\....................$)

### The Vertical Bar

The Vertical Bar "|" between patterns means OR. John|Peter matches John or Peter. John .*Peter|Peter .*John matches John ... Peter or Peter ... John. (.* slows a search) pain|suffering|sorrow matches pain, or suffering, or sorrow.

### The Parentheses

The use of Parentheses "( )" is not supported!

### The Backslash Prior to a Special Character

The Backslash prior to a special character ("\*") indicates that the character is not being used in its special meaning, but is just to match itself. amen\. matches amen. but not ament and will not locate firmament.

### The Backslash Prior to an Ordinary Character

The Backslash prior to an ordinary character ("\o") indicates that the character is not being used to match itself, but has special meaning.

- \b if use outside [ ] means word boundary. If used inside [ ] means backspace. \brighteous\b matches righteous but not unrighteous or righteousness

- \B means non-word boundary. \Brighteous\B matches unrighteousness and unrighteously but not righteous, unrighteous or righteousness.

- \d means digit; same as [0-9].

- \D means non-digit, same as [^0-9].

- \s means space.

- \S means not a space.

- \w means alphanumeric; same as [a-zA-Z0-9_].

- \W means not alphanumeric; same as [^a-zA-Z0-9_].