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