Tcl Mode



Commands

regexp
regexp ?flags? pattern string ?match sub1 sub2...?
-nocase
regexp or regsub - ignore case.
-indices
regexp - index pair for matching \[sub\]string.
--
regexp or regsub - separate flags from pattern.
regsub
regsub ?switches? pattern string subspec varname
-all
regsub - replace all occurrences.

Classes

.
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

.
Match anything except the newline character.
?
One match allowed, but its optional.
*
Zero or more matches allowed.
+
One match required, additional are optional.

anchors

^
Insert start of line position marker.
$
Insert end of line position marker.
^$
Match a blank line.
^.*$
Match an entire line.

Grouping

(
Start a group or back reference.
)
End a group or back reference.
\(
Start a sub-pattern.
\)
End a sub-pattern.
{
Start protecting regexp from being interpreted.
}
End protecting regexp from being interpreted.

other

&
regsub - Replaced with matched pattern.
\1
Replaced with 1st sub-pattern in pattern.
\2
Replaced with 2nd sub-pattern in pattern.
\3
Replaced with 3rd sub-pattern in pattern.
"\"
Used to escape special characters like \n.
|
Alternate (or) - a|b|c matches either a or b or c.


Index