Regular Expression Syntax Summary |
|
Regular expressions do not need to be all that confusing. In one sense, they are no more than more flexible extensions of the familiar DOS wild card characters '*' (which matches zero or more characters) and '?' (which matches one character) which are used for specifying filenames. They are, however, much more powerful and flexible than DOS wild cards.
Regular expressions consist of a combination of literal text characters and regular expression "metacharacters". To conduct a search on the Command Line using regular expressions, begin by entering a tilde (~) on the Command Line. A full list of the regular expression metacharacters recognized by BibleWorks follows:
|
Symbol |
Name |
|
\ |
Escape |
|
" |
Quotation |
|
. |
Any |
|
^ |
Line begin (or character class negation) |
|
$ |
Line end |
|
[ |
Character class begin |
|
- |
Character class range separator |
|
] |
Character class end |
|
( |
Group begin |
|
) |
Group end |
|
? |
Option |
|
* |
Closure |
|
+ |
Positive closure |
|
| |
Alternation |
In the following examples, "s" represents a literal character string
and "r" represents a regular expression:
|
Expression |
Matches |
Example |
|
c |
Any literal character |
a |
|
\c |
Character c literally |
\* |
|
"s" |
String s literally |
"**" |
|
. |
Any character but newline |
a.b |
|
^ |
Beginning of line |
^abc |
|
$ |
End of line |
abc$ |
|
[s] |
Any character in s |
[abc] |
|
[^s |
Any character not in s |
[^abc] |
|
r1r2 |
r1 followed by r2 |
ab |
|
r? |
Zero or one r's |
a? |
|
r* |
Zero or more r's |
a* |
|
r+ |
One or more r's |
a+ |
|
r1 | r2 |
r1 or r2 |
a | b |
|
(r) |
r |
(a | b) |