-
-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interp: fix multi-line shell pattern match equality
commit be03afe added the multi-line flag to the regexp generated for `==` and `=!` testing. However, this flag is confusing as it allows for a regular expression to match one line out of a multi-line input. (m) multi-line mode: ^ and $ match begin/end line in addition to begin/end text (default false) This means we are now matching against just one line in a multi-line string, rather than the entire text. Instead, to match Bash's behavior, we add the `s` flag to the regexp: (s) let . match \n (default false) With this a `*` in a shell pattern will match `\n`. Glob patterns should always match newline characters, so add the `s` flag by default when creating a pattern. Alternately we could add the `s` flag only when the `.` meta-character is needed, but that seemed more fragile. This behavior worked by accident with file globs because rather than matching with `.*` we match with `[^/]*` which does match `\n`.
- Loading branch information
1 parent
169e304
commit 6f30262
Showing
6 changed files
with
94 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters