Named substring support

This commit is contained in:
David Morán
2015-09-28 02:21:21 +02:00
parent 80c987c9ef
commit 8f1f678f76
2 changed files with 30 additions and 1 deletions

View File

@@ -25,6 +25,7 @@
#include "Poco/Foundation.h"
#include <vector>
#include <map>
//
@@ -91,8 +92,10 @@ public:
{
std::string::size_type offset; /// zero based offset (std::string::npos if subexpr does not match)
std::string::size_type length; /// length of substring
std::string name; /// name of group
};
typedef std::vector<Match> MatchVec;
typedef std::map<int, std::string> GroupMap;
RegularExpression(const std::string& pattern, int options = 0, bool study = true);
/// Creates a regular expression and parses the given pattern.
@@ -212,6 +215,8 @@ private:
pcre* _pcre;
pcre_extra* _extra;
GroupMap _groups;
static const int OVEC_SIZE;
RegularExpression();