Skip to content

Commit 7ff235a

Browse files
committed
feat: support regular expression for performing contains (=~) filtering
1 parent d4b8b87 commit 7ff235a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

jsonpath_ng/ext/filter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# under the License.
1313

1414
import operator
15+
import re
1516
from six import moves
1617

1718
from .. import JSONPath, DatumInContext, Index
@@ -25,7 +26,7 @@
2526
'<': operator.lt,
2627
'>=': operator.ge,
2728
'>': operator.gt,
28-
'=~': operator.contains,
29+
'=~': lambda a, b: True if re.search(b, a) else False,
2930
}
3031

3132

0 commit comments

Comments
 (0)