diff options
author | Lars Wirzenius <liw@liw.fi> | 2019-03-23 15:02:11 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2019-03-23 15:02:11 +0200 |
commit | cadf0af1a130fb6d24ecf6a826145ae392cd3516 (patch) | |
tree | 8346137bec360caf09295b04f1ed64991a390c50 /effitool | |
parent | 5556d03b339f00adf4e61de8a24f3e068d82157c (diff) | |
download | effitool-cadf0af1a130fb6d24ecf6a826145ae392cd3516.tar.gz |
Add: regexp search
Diffstat (limited to 'effitool')
-rwxr-xr-x | effitool | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -22,6 +22,7 @@ import configparser import http import json import os +import re import sys import traceback import urllib.request @@ -313,11 +314,18 @@ class ContainsCond(SearchCond): return pattern in value +class RegexCond(SearchCond): + + def op(self, value, pattern): + return re.search(pattern, value) + + class CondFactory: _pairs = [ ('=', ExactCond), (':', ContainsCond), + ('~', RegexCond), ] def parse(self, cond): |