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


Regex

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.6.2 The Range Operator (-)

Regex recognizes range expressions inside a list. They represent those characters that fall between two elements in the current collating sequence. You form a range expression by putting a range operator between two characters.(3) `-' represents the range operator. For example, `a-f' within a list represents all the characters from `a' through `f' inclusively.

If the syntax bit RE_NO_EMPTY_RANGES is set, then if the range's ending point collates less than its starting point, the range (and the regular expression containing it) is invalid. For example, the regular expression `[z-a]' would be invalid. If this bit isn't set, then Regex considers such a range to be empty.

Since `-' represents the range operator, if you want to make a `-' character itself a list item, you must do one of the following:

For example, `[-a-z]' matches a lowercase letter or a hyphen (in English, in ASCII).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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