Skip to content

Commit

Permalink
tweaks to regex concept docs (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
glennj authored Jan 20, 2024
1 parent 904e700 commit 0f8be23
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
14 changes: 13 additions & 1 deletion concepts/regular-expressions/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ The `scan` filter is similar to `match` with the `"g"` flag.
```jq
STRING | scan(REGEX)
STRING | scan(REGEX; FLAGS)
STRING | scan([REGEX, FLAGS])
# note, there is no scan([REGEX, FLAGS]) version, unlike other filters
```

`scan` will output a _stream_ of substrings.
Expand All @@ -139,6 +140,17 @@ Use the `[...]` array constructor to capture the substrings.
# => ["o", "o", "e", "a"]
```

~~~~exercism/note
Note that jq v1.6 does _not_ implement the 2-argument `scan` function, even though the version 1.6 manual [says it does][manual-scan-1.6]:
* [version 1.7 source code][src-scan-1.7]
* [version 1.6 source code][src-scan-1.6]
[manual-scan-1.6]: https://jqlang.github.io/jq/manual/v1.6/#scan
[src-scan-1.7]: https://github.com/jqlang/jq/blob/11c528d04d76c9b9553781aa76b073e4f40da008/src/builtin.jq#L92)
[src-scan-1.6]: https://github.com/jqlang/jq/blob/2e01ff1fb69609540b2bdc4e62a60499f2b2fb8e/src/builtin.jq#L90)
~~~~

### Splitting a String

If you know the parts of the string you want to **keep**, use `match` or `scan`.
Expand Down
12 changes: 11 additions & 1 deletion concepts/regular-expressions/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ The `scan` filter is similar to `match` with the `"g"` flag.
```jq
STRING | scan(REGEX)
STRING | scan(REGEX; FLAGS)
STRING | scan([REGEX, FLAGS])
```

`scan` will output a _stream_ of substrings.
Expand All @@ -139,6 +138,17 @@ Use the `[...]` array constructor to capture the substrings.
# => ["o", "o", "e", "a"]
```

~~~~exercism/note
Note that jq v1.6 does _not_ implement the 2-argument `scan` function, even though the version 1.6 manual [says it does][manual-scan-1.6]:
* [version 1.7 source code][src-scan-1.7]
* [version 1.6 source code][src-scan-1.6]
[manual-scan-1.6]: https://jqlang.github.io/jq/manual/v1.6/#scan
[src-scan-1.7]: https://github.com/jqlang/jq/blob/11c528d04d76c9b9553781aa76b073e4f40da008/src/builtin.jq#L92)
[src-scan-1.6]: https://github.com/jqlang/jq/blob/2e01ff1fb69609540b2bdc4e62a60499f2b2fb8e/src/builtin.jq#L90)
~~~~

### Splitting a String

If you know the parts of the string you want to **keep**, use `match` or `scan`.
Expand Down
4 changes: 4 additions & 0 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Please head to [the `jq` wiki][jq-wiki-install] for the installation instruction
## Version Information

As of October 2023, the current jq release is version 1.7.
This is the version used in the online jq test runner.

Most Linux package managers will install the previous release, version 1.6.
It's worth installing the newer version: there were [substantial changes in the 1.7 release][release-notes-1.7].

[jq-wiki-install]: https://github.com/jqlang/jq/wiki/Installation
[release-notes-1.7]: https://github.com/jqlang/jq/releases/tag/jq-1.7
12 changes: 11 additions & 1 deletion exercises/concept/regular-chatbot/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ The `scan` filter is similar to `match` with the `"g"` flag.
```jq
STRING | scan(REGEX)
STRING | scan(REGEX; FLAGS)
STRING | scan([REGEX, FLAGS])
```

`scan` will output a _stream_ of substrings.
Expand All @@ -141,6 +140,17 @@ Use the `[...]` array constructor to capture the substrings.
# => ["o", "o", "e", "a"]
```

~~~~exercism/note
Note that jq v1.6 does _not_ implement the 2-argument `scan` function, even though the version 1.6 manual [says it does][manual-scan-1.6]:
* [version 1.7 source code][src-scan-1.7]
* [version 1.6 source code][src-scan-1.6]
[manual-scan-1.6]: https://jqlang.github.io/jq/manual/v1.6/#scan
[src-scan-1.7]: https://github.com/jqlang/jq/blob/11c528d04d76c9b9553781aa76b073e4f40da008/src/builtin.jq#L92)
[src-scan-1.6]: https://github.com/jqlang/jq/blob/2e01ff1fb69609540b2bdc4e62a60499f2b2fb8e/src/builtin.jq#L90)
~~~~

#### Splitting a String

If you know the parts of the string you want to **keep**, use `match` or `scan`.
Expand Down

0 comments on commit 0f8be23

Please sign in to comment.