Skip to content

Commit

Permalink
Edit parse notes (#1429)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanManske committed May 30, 2024
1 parent 9281317 commit 2eceaa3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions blog/2024-05-28-nushell_0_94_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,18 @@ open --raw file.txt | skip 1024 | parse -r "some regex"
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:
```nushell
^cat file.txt | collect | parse -r "some regex"
let text = open file.txt
$text | parse -r "some regex"
```

Note that this change does not affect normal value streams like
Note that this change does not affect normal value streams like:
```nushell
[(open foo.txt) (open bar.txt)] | parse -r "..."
[(open foo.txt) (open bar.txt)] | parse -r "some regex"
```
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.
In this case, the regex is run separately over each string value in the stream. With the proper regex flags, the regex is able to match across multiple lines within the same string value.

Note that `parse` may see more breaking changes in the next release to simplify this behavior.
Note that `parse` may see more breaking changes in the next release to simplify these behaviors.

#### `scope commands` [[toc](#table-of-content)]

Expand Down

0 comments on commit 2eceaa3

Please sign in to comment.