Consistently use \textasciicircum to produce a ^ character.
LaTeX really falls flat on this one!
This commit is contained in:
parent
2eeec9bde5
commit
7bc6f7ac7b
|
@ -93,8 +93,9 @@ The special characters are:
|
||||||
character except a newline. If the \constant{DOTALL} flag has been
|
character except a newline. If the \constant{DOTALL} flag has been
|
||||||
specified, this matches any character including a newline.
|
specified, this matches any character including a newline.
|
||||||
|
|
||||||
\item[\character{\^}] (Caret.) Matches the start of the string, and in
|
\item[\character{\textasciicircum}] (Caret.) Matches the start of the
|
||||||
\constant{MULTILINE} mode also matches immediately after each newline.
|
string, and in \constant{MULTILINE} mode also matches immediately
|
||||||
|
after each newline.
|
||||||
|
|
||||||
\item[\character{\$}] Matches the end of the string or just before the
|
\item[\character{\$}] Matches the end of the string or just before the
|
||||||
newline at the end of the string, and in \constant{MULTILINE} mode
|
newline at the end of the string, and in \constant{MULTILINE} mode
|
||||||
|
@ -181,10 +182,14 @@ backslash, or place it as the first character. The
|
||||||
pattern \regexp{[]]} will match \code{']'}, for example.
|
pattern \regexp{[]]} will match \code{']'}, for example.
|
||||||
|
|
||||||
You can match the characters not within a range by \dfn{complementing}
|
You can match the characters not within a range by \dfn{complementing}
|
||||||
the set. This is indicated by including a \character{\^} as the first
|
the set. This is indicated by including a
|
||||||
character of the set; \character{\^} elsewhere will simply match the
|
\character{\textasciicircum} as the first character of the set;
|
||||||
\character{\^} character. For example, \regexp{[{\^}5]} will match
|
\character{\textasciicircum} elsewhere will simply match the
|
||||||
any character except \character{5}.
|
\character{\textasciicircum} character. For example,
|
||||||
|
\regexp{[{\textasciicircum}5]} will match
|
||||||
|
any character except \character{5}, and
|
||||||
|
\regexp{[\textasciicircum\code{\textasciicircum}]} will match any character
|
||||||
|
except \character{\textasciicircum}.
|
||||||
|
|
||||||
\item[\character{|}]\code{A|B}, where A and B can be arbitrary REs,
|
\item[\character{|}]\code{A|B}, where A and B can be arbitrary REs,
|
||||||
creates a regular expression that will match either A or B. An
|
creates a regular expression that will match either A or B. An
|
||||||
|
@ -318,13 +323,13 @@ Python's string literals.
|
||||||
equivalent to the set \regexp{[0-9]}.
|
equivalent to the set \regexp{[0-9]}.
|
||||||
|
|
||||||
\item[\code{\e D}]Matches any non-digit character; this is
|
\item[\code{\e D}]Matches any non-digit character; this is
|
||||||
equivalent to the set \regexp{[{\^}0-9]}.
|
equivalent to the set \regexp{[{\textasciicircum}0-9]}.
|
||||||
|
|
||||||
\item[\code{\e s}]Matches any whitespace character; this is
|
\item[\code{\e s}]Matches any whitespace character; this is
|
||||||
equivalent to the set \regexp{[ \e t\e n\e r\e f\e v]}.
|
equivalent to the set \regexp{[ \e t\e n\e r\e f\e v]}.
|
||||||
|
|
||||||
\item[\code{\e S}]Matches any non-whitespace character; this is
|
\item[\code{\e S}]Matches any non-whitespace character; this is
|
||||||
equivalent to the set \regexp{[\^\ \e t\e n\e r\e f\e v]}.
|
equivalent to the set \regexp{[\textasciicircum\ \e t\e n\e r\e f\e v]}.
|
||||||
|
|
||||||
\item[\code{\e w}]When the \constant{LOCALE} and \constant{UNICODE}
|
\item[\code{\e w}]When the \constant{LOCALE} and \constant{UNICODE}
|
||||||
flags are not specified,
|
flags are not specified,
|
||||||
|
@ -337,7 +342,7 @@ in the Unicode character properties database.
|
||||||
|
|
||||||
\item[\code{\e W}]When the \constant{LOCALE} and \constant{UNICODE}
|
\item[\code{\e W}]When the \constant{LOCALE} and \constant{UNICODE}
|
||||||
flags are not specified, matches any non-alphanumeric character; this
|
flags are not specified, matches any non-alphanumeric character; this
|
||||||
is equivalent to the set \regexp{[{\^}a-zA-Z0-9_]}. With
|
is equivalent to the set \regexp{[{\textasciicircum}a-zA-Z0-9_]}. With
|
||||||
\constant{LOCALE}, it will match any character not in the set
|
\constant{LOCALE}, it will match any character not in the set
|
||||||
\regexp{[0-9_]}, and not defined as a letter for the current locale.
|
\regexp{[0-9_]}, and not defined as a letter for the current locale.
|
||||||
If \constant{UNICODE} is set, this will match anything other than
|
If \constant{UNICODE} is set, this will match anything other than
|
||||||
|
@ -361,7 +366,8 @@ semantics, the search operation is what you're looking for. See the
|
||||||
regular expression objects.
|
regular expression objects.
|
||||||
|
|
||||||
Note that match may differ from search using a regular expression
|
Note that match may differ from search using a regular expression
|
||||||
beginning with \character{\^}: \character{\^} matches only at the
|
beginning with \character{\textasciicircum}:
|
||||||
|
\character{\textasciicircum} matches only at the
|
||||||
start of the string, or in \constant{MULTILINE} mode also immediately
|
start of the string, or in \constant{MULTILINE} mode also immediately
|
||||||
following a newline. The ``match'' operation succeeds only if the
|
following a newline. The ``match'' operation succeeds only if the
|
||||||
pattern matches at the start of the string regardless of mode, or at
|
pattern matches at the start of the string regardless of mode, or at
|
||||||
|
@ -429,14 +435,14 @@ Make \regexp{\e w}, \regexp{\e W}, \regexp{\e b}, and
|
||||||
|
|
||||||
\begin{datadesc}{M}
|
\begin{datadesc}{M}
|
||||||
\dataline{MULTILINE}
|
\dataline{MULTILINE}
|
||||||
When specified, the pattern character \character{\^} matches at the
|
When specified, the pattern character \character{\textasciicircum}
|
||||||
beginning of the string and at the beginning of each line
|
matches at the beginning of the string and at the beginning of each
|
||||||
(immediately following each newline); and the pattern character
|
line (immediately following each newline); and the pattern character
|
||||||
\character{\$} matches at the end of the string and at the end of each
|
\character{\$} matches at the end of the string and at the end of each
|
||||||
line (immediately preceding each newline). By default, \character{\^}
|
line (immediately preceding each newline). By default,
|
||||||
matches only at the beginning of the string, and \character{\$} only
|
\character{\textasciicircum} matches only at the beginning of the
|
||||||
at the end of the string and immediately before the newline (if any)
|
string, and \character{\$} only at the end of the string and
|
||||||
at the end of the string.
|
immediately before the newline (if any) at the end of the string.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{S}
|
\begin{datadesc}{S}
|
||||||
|
@ -623,7 +629,8 @@ attributes:
|
||||||
|
|
||||||
The optional second parameter \var{pos} gives an index in the string
|
The optional second parameter \var{pos} gives an index in the string
|
||||||
where the search is to start; it defaults to \code{0}. This is not
|
where the search is to start; it defaults to \code{0}. This is not
|
||||||
completely equivalent to slicing the string; the \code{'\^'} pattern
|
completely equivalent to slicing the string; the
|
||||||
|
\code{'\textasciicircum'} pattern
|
||||||
character matches at the real beginning of the string and at positions
|
character matches at the real beginning of the string and at positions
|
||||||
just after a newline, but not necessarily at the index where the search
|
just after a newline, but not necessarily at the index where the search
|
||||||
is to start.
|
is to start.
|
||||||
|
|
Loading…
Reference in New Issue