Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
3
Task/String-matching/Jq/string-matching-1.jq
Normal file
3
Task/String-matching/Jq/string-matching-1.jq
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# startswith/1 is boolean:
|
||||
"abc" | startswith("ab")
|
||||
#=> true
|
||||
6
Task/String-matching/Jq/string-matching-2.jq
Normal file
6
Task/String-matching/Jq/string-matching-2.jq
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# index/1 returns the index or null,
|
||||
# so the jq test "if index(_) then ...." can be used
|
||||
# without any type conversion.
|
||||
|
||||
"abcd" | index( "bc")
|
||||
#=> 1
|
||||
3
Task/String-matching/Jq/string-matching-3.jq
Normal file
3
Task/String-matching/Jq/string-matching-3.jq
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# endswith/1 is also boolean:
|
||||
"abc" | endswith("bc")
|
||||
#=> true
|
||||
5
Task/String-matching/Jq/string-matching-4.jq
Normal file
5
Task/String-matching/Jq/string-matching-4.jq
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"abc" | test( "^ab")
|
||||
|
||||
"abcd" | test("bc")
|
||||
|
||||
"abcd" | test("cd$")
|
||||
6
Task/String-matching/Jq/string-matching-5.jq
Normal file
6
Task/String-matching/Jq/string-matching-5.jq
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# In jq 1.4 or later:
|
||||
jq -n '"abcdabcd" | indices("bc")'
|
||||
[
|
||||
1,
|
||||
5
|
||||
]
|
||||
3
Task/String-matching/Jq/string-matching-6.jq
Normal file
3
Task/String-matching/Jq/string-matching-6.jq
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$ jq -n '"abcdabcd" | match("bc"; "g") | .offset'
|
||||
1
|
||||
5
|
||||
Loading…
Add table
Add a link
Reference in a new issue