Grep Mode



Character Classes

A character class allows you to match a group of meta-characters in your regular expression. For example, the following matches all digits:

[0123456789]

To save you from having to type in a lot meta-characters, ranges are represented in the following manner:

[a-zA-Z]

This regular expression matches any single letter, in both upper and lower case.

If you look at the buttons in tkREM's Grep Mode, you will notice some pretty convenient ranges are available to you. The definitions below summarizes them.

.
Match anything except the newline character.
[
Start a character class.
[^
Start a negated character class.
]
Close a character class.
-
Create a character range like a-h.
a-z
Match any lowercase letter.
A-Z
Match any uppercase letter.
0-9
Match any digit.


Counting Meta-Characters

These meta-characters govern how greedy to make match, or how many times to match a regular expression. The definitions below summarize them.

.
Match anything except the newline character.
?
One match allowed, but its optional.
*
Zero or more matches allowed.
+
One match required, additional are optional.
\{
Start Min required, Max allowed set - \{min,max\}.
,
Seperator for \{min,max\}
\}
End Min required, Max allowed set - \{min,max\}.


Anchor Meta-Characters

How do you indicate you want to start from the beginning of a line? How do you match a blank line? Find out by reviewing the summaries below.

^
Insert start of line position marker.
$
Insert end of line position marker.
^$
Match a blank line.
^.*$
Match an entire line.
\<
Start a word boundary.
\>
End a word boundary.

Other Meta-Characters

This section contains a mixed bag of meta-characters. The most common usage of them is for making or statements:

(apples|oranges|pears)

matches any of the strings seperated by the pipe | character. The usual summary appears below.

(
Start a group or back reference.
)
End a group or back reference.
|
Alternate (or) - a|b|c matches either a or b or c.
"\"
Used to escape special characters like \\n.
\1
Text previously matched with 1st of parenthesis.
\2
Text previously matched with 2nd of parenthesis.
\3
Text previously matched with 3rd of parenthesis.


Index