SGL
privateregexpr.h
1 /*
2  * File: regexpr.h
3  * ---------------
4  * This file exports functions for performing regular expression operations
5  * on C++ strings. It will be unnecessary once the C++11 regex library
6  * is widely available, but as of this writing the regex library is not
7  * supported on gcc and other major C++ compilers.
8  *
9  * The regular expression functions are implemented by sending the strings and
10  * regexes to the Java Back-End to run the operations in Java. This is a bit
11  * kludgy but we don't want to write our own regex parser from scratch.
12  * Using Java's is a compromise for now.
13  *
14  * @author Marty Stepp
15  * @version 2021/04/03
16  * - removed dependency on custom collections
17  * @version 2018/09/25
18  * - added doc comments for new documentation generation
19  * @version 2018/09/20
20  * - added Qt version checking around some regex functions for compatibility
21  * @version 2014/10/14
22  * - removed regexMatchCountWithLines for simplicity
23  * @since 2014/03/01
24  */
25 
26 
27 #ifndef _regexpr_h
28 #define _regexpr_h
29 
30 #include <string>
31 #include <vector>
32 
38 bool regexMatch(const string& s, const string& regexp);
39 
45 int regexMatchCount(const string& s, const string& regexp);
46 
55 int regexMatchCountWithLines(const string& s, const string& regexp,
56  string& linesOut);
57 
66 void regexMatchCountWithLines(const string& s, const string& regexp,
67  std::vector<int>& linesOut);
68 
75 string regexReplace(const string& s, const string& regexp,
76  const string& replacement, int limit = -1);
77 
78 #endif // _regexpr_h