aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaheed Haque <srhaque@theiet.org>2017-01-29 20:58:37 +0000
committerStephen Kelly <steveire@gmail.com>2017-02-04 10:23:42 +0000
commit352dc8e843491ce29e3dd9396477cb67fa2ca4f3 (patch)
tree1becf63aabacc6092d847b1a2ed9b7b18029e16a
parent16a148feda4e9761e2644972c4623b355ffa7e92 (diff)
downloadextra-cmake-modules-352dc8e843491ce29e3dd9396477cb67fa2ca4f3.tar.gz
extra-cmake-modules-352dc8e843491ce29e3dd9396477cb67fa2ca4f3.tar.bz2
Bindings: Add an end marker to the regex pattern
Fix the anchoring of the regular expression matching to cover the complete input. This was an oversight and should have no visible effects except that if new fields are added to a rule database, existing rules with wildcards will greedily match the new fields.
-rwxr-xr-xfind-modules/rules_engine.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/find-modules/rules_engine.py b/find-modules/rules_engine.py
index 9c617159..8ec5ac5c 100755
--- a/find-modules/rules_engine.py
+++ b/find-modules/rules_engine.py
@@ -80,7 +80,10 @@ class Rule(object):
try:
groups = ["(?P<{}>{})".format(name, pattern) for pattern, name in pattern_zip]
groups = _SEPARATOR.join(groups)
- self.matcher = re.compile(groups)
+ #
+ # We'll use re.match to anchor the start of the match, and so need a $ to anchor the end.
+ #
+ self.matcher = re.compile(groups + "$")
except Exception as e:
groups = ["{} '{}'".format(name, pattern) for pattern, name in pattern_zip]
groups = ", ".join(groups)