sshregex(5)sshregex(5)NAMEsshregex - Glob (wildcard) patterns
DESCRIPTION
The sshregex file describes the regular expressions (or globbing pat‐
terns) used in filename globbing with the scp2 and sftp2 commands and
in the ssh2_config and sshd2_config configuration files.
Regex syntax used with scp2 and sftp2 is ZSH_FILEGLOB.
PATTERNS FOR REGEX SYNTAX: EGREP
The escape character is a backslash (\). You can use the backslash to
specify metacharacters that you want to use in their plain character
form. In the following examples, literal E and F denote any expres‐
sion, such as a pattern or character. Start a capturing subexpression.
End a capturing subexpression. Disjunction, match either E or F
(inclusive). E is preferred if both match. Act as Kleene star, match
E zero or more times. Closure, match E one or more times. Option,
match E optionally once. Match any character except for newline char‐
acters (\n, \f, \r) and the NUL byte. Match E exactly n times. Match
E n or more times. Match E at most n times. Match E no less than n
times and no more than m times. Start a character set. (See CHARACTER
SETS FOR EGREP AND ZSH_FILEGLOB section. Match the empty
string at the end of the input or at the end of a line. Match the
empty string at the start of the input or at the beginning of a line.
ESCAPED TOKENS FOR REGEX SYNTAX: EGREP
The literal byte with octal value n..n. The NUL byte. The literal
byte with decimal value [1-9]..x. The literal byte with hexadecimal
value n..n. Match the empty string at the beginning of a word. Match
the empty string at the end of a word. Match the empty string at a
word boundary. Match the empty string provided it is not at a word
boundary. Match a word-constituent character, equivalent to
[a:zA:Z0:9-]. Match a non-word-constituent character. Literal alarm
character. Literal escape character. Literal line feed. Literal new
line, equivalent to C's \n so can be more than one character long.
Literal carriage return. Literal tab.
All other escaped characters denote the literal character itself.
PATTERNS FOR REGEX SYNTAX: ZSH_FILEGLOB (or TRADITIONAL)
The escape character is a backslash (\). You can use the backslash to
specify metacharacters that you want to use in their plain character
form. In the following examples, literal E and F denote any expres‐
sion, such as a pattern or character. Match any character string. The
characters can be any characters except for slash (/). However, the
asterisk does not match a string if a dot (.) is the first character,
or if the string contains a dot immediately after a slash. If the pre‐
vious character is a slash (/), or the asterisk (*) is used to denote a
match at the beginning of a string, the asterisk does match a dot (.).
That is, the asterisk functions as it does in Tru64 UNIX shell file
globs. Match any single character except for a slash (/). However, do
not match a dot (.) if located at the beginning of the string, or if
the previous character is a slash (/). That is, the question mark (?)
functions as it does in Tru64 UNIX shell file globs. Match any
sequence of characters that is either empty or ends in a slash. How‐
ever, the substring /. is not allowed. The double asterisk (**) is
equivalent to the single asterisk (*). Act as Kleene star; match E
zero or more times. Closure; match E one or more times. Start a cap‐
turing subexpression. End a capturing subexpression. Disjunction,
match either E or F (inclusive). E is preferred if both match. Start
a character set. .
CHARACTER SETS FOR EGREP AND ZSH_FILEGLOB
A character set starts with the open bracket ( [ ) and ends at the non-
escaped close bracket ( ] ) that is not part of a POSIX character set
specifier and does not follow immediately after an open bracket. The
following characters have a special meaning and need to be escaped if
meant literally: A range operator, except immediately after an open
bracket, where it loses its special meaning. If immediately after
starting an open bracket, denotes a complement: the whole character set
will be complemented. Otherwise literal ^. Characters for which isal‐
num returns true. Characters for which isalpha returns true. Charac‐
ters for which iscntrl returns true. Characters for which isdigit
returns true. Characters for which isgraph returns true. Characters
for which islower returns true. Characters for which isprint returns
true. Characters for which ispunct returns true. Characters for which
isspace returns true. Characters for which isupper returns true.
Characters for which isxdigit returns true.
PATTERNS FOR REGEX SYNTAX: SSH
The escape character is a tilde (~). You can use the tilde to specify
metacharacters that you want to use in their plain character form. In
the following examples, literal E and F denote any expression, such as
a pattern or character. Start a capturing subexpression. End a cap‐
turing subexpression. Start anonymous, non-capturing subexpression.
End anonymous, non-capturing subexpression. Disjunction, match either
E or F (inclusive). E is preferred if both match. Act as Kleene star,
match E zero or more times. Act as Kleene star, but match non-greedily
(lazy match). Closure, match E one or more times. Closure, but match
non-greedily (lazy match). Option, match E optionally once. Option,
but match non-greedily (lazy match). Match any character except for
newline characters (\n, \f, \r) and the NUL byte. Match E exactly n
times. Match E n or more times. Match E at most n times. Match E no
less than n times and no more than m times. The lazy versions of
above.. Start a character set. One-character lookahead. The C must
be either a literal character or parse as a character set. You can
match the empty string anywhere, provided that the next character is C
or belongs to it. One-character lookback. Same as above, but examines
the previous character instead of the next character. Match the empty
string at the end of the input. Match the empty string at the start of
the input.
ESCAPED TOKENS FOR REGEX SYNTAX: SSH
The literal byte with octal value n..n. The NUL byte. The literal
byte with decimal value [1-9]..x. The literal byte with hexadecimal
value n..n. Match the empty string at the beginning of a word. Match
the empty string at the end of a word. Match the empty string at a
word boundary. Match the empty string provided it is not at a word
boundary. Match any digit, equivalent to [0:9]. Match any character
except a digit. Match a whitespace character (matches space, newline,
line feed, car- riage return, tab and vertical tab). Match a
non-whitespace character. Match a word-constituent character, equiva‐
lent to [a:zA:Z0:9-]. Match a non-word-constituent character. Literal
alarm character. Literal escape character. Literal line feed. Lit‐
eral new line, equivalent to C's \n so can be more than one character
long. Literal carriage return. Literal tab.
All other escaped characters denote the literal character itself.
CHARACTER SETS FOR REGEX SYNTAX SSH
A character set starts with the open bracket ( [ ) and ends at the non-
escaped close bracket ( ] ) that is not part of a POSIX character set
specifier and does not follow immediately after an open bracket. The
following characters have a special meaning and need to be escaped if
meant literally: A range operator, except immediately after an open
bracket where it loses its special meaning. Until next +, the charac‐
ters, ranges, and sets will be subtracted from the current set instead
of adding. If it appears as the first character after an open bracket,
it starts subtracting from a set containing all characters instead of
the empty set. Until next -, the characters, ranges, and sets will be
added to the current set. This is the default. Characters for which
isalnum returns true. Characters for which isalpha returns true.
Characters for which iscntrl returns true. Characters for which
isdigit returns true. Characters for which isgraph returns true.
Characters for which islower returns true. Characters for which
isprint returns true. Characters for which ispunct returns true.
Characters for which isspace returns true. Characters for which isup‐
per returns true. Characters for which isxdigit returns true.
It is also possible to include the predefined escaped character sets
into a newly defined one, so [~d~s] matches digits and white‐
space characters. Also, escape sequences resulting in literals work
inside character sets.
EXAMPLE
[[:xdigit:]XY] is typically equivalent to [[0123456789ABCDEFabcdefXY].
LEGAL NOTICES
SSH is a registered trademark of SSH Communication Security Ltd.
SEE ALSO
Commands: scp2(1), sftp2(1)
Files: ssh2_config(4), sshd2_config(4)sshregex(5)