3 /* C++ wrapper around the POSIX regex functions:
4 regcomp, regexec, regerror, regfree.
22 LRegex(string const & regex);
28 typedef pair<string::size_type, string::size_type> MatchPair;
31 typedef vector<MatchPair> SubMatches;
33 /// Returns all the matches in a vector
34 SubMatches const & exec(string const & str) const;
36 /// The whole of str matches regex.
37 bool exact_match(string const & str) const;
40 MatchPair first_match(string const & str) const;
43 string getError() const;
46 int getErrorCode() const;
48 /// Will the next operation fail of not.
59 // We comment out these, we can comment them in when we need them.
61 // some built in regular expressions
63 extern const LRegex LRXwhite; // = "[ \n\t\r\v\f]+"
64 extern const LRegex LRXint; // = "-?[0-9]+"
65 extern const LRegex LRXdouble; // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
66 // \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)
67 // \\([eE][---+]?[0-9]+\\)?"
68 //extern const LRegex LRXalpha; // = "[A-Za-z]+"
69 //extern const LRegex LRXlowercase; // = "[a-z]+"
70 //extern const LRegex LRXuppercase; // = "[A-Z]+"
71 //extern const LRegex LRXalphanum; // = "[0-9A-Za-z]+"
72 extern const LRegex LRXidentifier; // = "[A-Za-z_][A-Za-z0-9_]*"