www.delorie.com/gnu/docs/regex/regex_fot.html   search  
Buy the book!


[Top] [Contents] [Index] [ ? ]



Sometimes you don't have to explicitly quote special characters to make them ordinary. For instance, most characters lose any special meaning inside a list (see section 3.6 List Operators ([ ... ] and [^ ... ])). In addition, if the syntax bits RE_CONTEXT_INVALID_OPS and RE_CONTEXT_INDEP_OPS aren't set, then (for historical reasons) the matcher considers special characters ordinary if they are in contexts where the operations they represent make no sense; for example, then the match-zero-or-more operator (represented by `*') matches itself in the regular expression `*foo' because there is no preceding expression on which it can operate. It is poor practice, however, to depend on this behavior; if you want a special character to be ordinary outside a list, it's better to always quote it, regardless.


Regex therefore doesn't consider the `^' to be the first character in the list. If you put a `^' character first in (what you think is) a matching list, you'll turn it into a nonmatching list.


You can't use a character class for the starting or ending point of a range, since a character class is not a single character.


Regular expressions are also referred to as "patterns," hence the name "pattern buffer."


A table that maps all uppercase letters to the corresponding lowercase ones would work just as well for this purpose.

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003