From 9fcd9e7b3c969657612e1555419c733d7b1afab6 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 11 Apr 2014 06:22:14 +0300 Subject: [PATCH] re-pcre: Match: add start()/end() methods. --- re-pcre/re.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/re-pcre/re.py b/re-pcre/re.py index 6e5d3bce..e4ad70db 100644 --- a/re-pcre/re.py +++ b/re-pcre/re.py @@ -38,6 +38,12 @@ class PCREMatch: def group(self, n): return self.s[self.offsets[n*2]:self.offsets[n*2+1]] + def start(self, n=0): + return self.offsets[n*2] + + def end(self, n=0): + return self.offsets[n*2+1] + def span(self, n=0): return self.offsets[n*2], self.offsets[n*2+1]