diff options
author | Shaheed Haque <srhaque@theiet.org> | 2017-01-29 20:58:37 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2017-02-04 10:23:42 +0000 |
commit | 352dc8e843491ce29e3dd9396477cb67fa2ca4f3 (patch) | |
tree | 1becf63aabacc6092d847b1a2ed9b7b18029e16a /find-modules/rules_engine.py | |
parent | 16a148feda4e9761e2644972c4623b355ffa7e92 (diff) | |
download | extra-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.
Diffstat (limited to 'find-modules/rules_engine.py')
-rwxr-xr-x | find-modules/rules_engine.py | 5 |
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) |