Added regex support as per issue #164.
jq now depends on oniguruma for regex support. Modified configure.ac accordingly. Added valgrind suppression file for oniguruma to prevent one-time and bounded leaks from causing tests to fail. Signed-off-by: Nicolas Williams <nico@cryptonector.com>
This commit is contained in:
1 parent
5d9d1b1020
commit
8ff935c01a
7 files changed
+420
-2
No files matched your search
+45
-1
@@ -649,6 +649,50 @@ def inc(x): x |= .+1; inc(.[].a)
|
||||
["fo", "foo", "barfoo", "foobar", "barfoob"]
|
||||
[false, true, true, false, false]
|
||||
|
||||
# match builtin
|
||||
[match("( )*"; "g")]
|
||||
"abc"
|
||||
[{"offset":0, "length":0, "string":"", "captures":[]},{"offset":1, "length":0, "string":"", "captures":[]},{"offset":2, "length":0, "string":"", "captures":[]}]
|
||||
|
||||
[match("( )*"; "gn")]
|
||||
"abc"
|
||||
[]
|
||||
|
||||
[match("a"; "gi")]
|
||||
"āáàä"
|
||||
[]
|
||||
|
||||
[match(["(bar)"])]
|
||||
"foo bar"
|
||||
[{"offset": 4, "length": 3, "string": "bar", "captures":[{"offset": 4, "length": 3, "string": "bar", "name": null}]}]
|
||||
|
||||
# offsets account for combining codepoints and multi-byte UTF-8
|
||||
[match("bar")]
|
||||
"ā bar with a combining codepoint U+0304"
|
||||
[{"offset": 3, "length": 3, "string": "bar", "captures":[]}]
|
||||
|
||||
# matches with combining codepoints still count them in their length
|
||||
[match("bār")]
|
||||
"a bār"
|
||||
[{"offset": 2, "length": 4, "string": "bār", "captures":[]}]
|
||||
|
||||
[match(".+?\\b")]
|
||||
"ā two-codepoint grapheme"
|
||||
[{"offset": 0, "length": 2, "string": "ā", "captures":[]}]
|
||||
|
||||
[match(["foo (?<bar123>bar)? foo", "ig"])]
|
||||
"foo bar foo foo foo"
|
||||
[{"offset": 0, "length": 11, "string": "foo bar foo", "captures":[{"offset": 4, "length": 3, "string": "bar", "name": "bar123"}]},{"offset":12, "length": 8, "string": "foo foo", "captures":[{"offset": -1, "length": 0, "string": null, "name": "bar123"}]}]
|
||||
|
||||
#test builtin
|
||||
[test("( )*"; "gn")]
|
||||
"abc"
|
||||
[false]
|
||||
|
||||
[test("ā")]
|
||||
"ā"
|
||||
[true]
|
||||
|
||||
[.[]|ltrimstr("foo")]
|
||||
["fo", "foo", "barfoo", "foobar", "afoo"]
|
||||
["fo","","barfoo","bar","afoo"]
|
||||
@@ -857,4 +901,4 @@ flatten(2)
|
||||
|
||||
flatten(2)
|
||||
[0, [1, [2]], [1, [[3], 2]]]
|
||||
[0, 1, 2, 1, [3], 2]
|
||||
[0, 1, 2, 1, [3], 2]
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
onig node recycling
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:onig_parse_make_tree
|
||||
...
|
||||
}
|
||||
{
|
||||
onig unicode case insensitivity 1
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:setup_tree
|
||||
...
|
||||
}
|
||||
{
|
||||
onig unicode case insensitivity 2
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:onig*unicode*
|
||||
...
|
||||
}
|
||||
Reference in new issue
Block a user