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