| www.delorie.com/gnu/docs/regex/regex_23.html | search |
![]() Buy the book! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
^) This operator can match the empty string either at the beginning of the string or after a newline character. Thus, it is said to anchor the pattern to the beginning of a line.
In the cases following, `^' represents this operator. (Otherwise, `^' is ordinary.)
RE_CONTEXT_INDEP_ANCHORS is set, and it is outside
a bracket expression.
( ... ) or \( ... \)), and 3.5 The Alternation Operator (| or \|).
These rules imply that some valid patterns containing `^' cannot be
matched; for example, `foo^bar' if RE_CONTEXT_INDEP_ANCHORS
is set.
If the not_bol field is set in the pattern buffer (see section 7.1.1 GNU Pattern Buffers), then `^' fails to match at the beginning of the
string. See section 7.2.3 POSIX Matching, for when you might find this useful.
If the newline_anchor field is set in the pattern buffer, then
`^' fails to match after a newline. This is useful when you do not
regard the string to be matched as broken into lines.
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |