You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[_Changes to existing commands_](#changes-to-existing-commands-toc)
43
43
-[_Making range semantics consistent_](#making-range-semantics-consistent-toc)
44
+
-[_`parse`_](#parse-toc)
44
45
-[_`scope commands`_](#scope-commands-toc)
45
46
-[_`which`_](#which-toc)
46
47
-[_`describe`_](#describe-toc)
@@ -255,6 +256,38 @@ Ranges are inclusive in the upper bound by default in Nushell (e.g., `1..2` or `
255
256
256
257
To specify an exclusive upperbound, use the `..<` form for ranges (e.g., `1..<2`).
257
258
259
+
#### `parse`[[toc](#table-of-content)]
260
+
261
+
::: warning Breaking change
262
+
See a full overview of the [breaking changes](#breaking-changes)
263
+
:::
264
+
265
+
To support streaming output, `parse` now operates/matches on a single line at a time **only if provided with the streaming output of an external command, file, or raw byte stream**.
266
+
For example, these snippets will try to match each line separately:
The old behavior was to collect all of the output the external command or byte stream and then run the regex across the whole string. To mimic this behavior, you can use the `collect` command or store the output in a variable:
277
+
```nushell
278
+
^cat file.txt | collect | parse -r "some regex"
279
+
let text = open file.txt
280
+
$text | parse -r "some regex"
281
+
```
282
+
283
+
Note that this change does not affect normal value streams like
284
+
```nushell
285
+
[(open foo.txt) (open bar.txt)] | parse -r "..."
286
+
```
287
+
In this case, the regex is run once per string value in the stream and does a multi-line match over the contents of each string.
288
+
289
+
Note that `parse` may see more breaking changes in the next release to simplify this behavior.
0 commit comments