We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fae62ee commit a631d7bCopy full SHA for a631d7b
src/uu/expr/src/syntax_tree.rs
@@ -174,6 +174,8 @@ impl StringOp {
174
'^' => match (prev, prev_is_escaped) {
175
// Start of a capturing group
176
('(', true) => re_string.push(curr),
177
+ // Start of an alternative pattern
178
+ ('|', true) => re_string.push(curr),
179
// Character class negation "[^a]"
180
('[', false) => re_string.push(curr),
181
// Explicitly escaped caret
tests/by-util/test_expr.rs
@@ -282,6 +282,10 @@ fn test_regex() {
282
.args(&["a^b", ":", "a\\^b"])
283
.succeeds()
284
.stdout_only("3\n");
285
+ new_ucmd!()
286
+ .args(&["b", ":", "a\\|^b"])
287
+ .succeeds()
288
+ .stdout_only("1\n");
289
new_ucmd!()
290
.args(&["a$b", ":", "a\\$b"])
291
0 commit comments