On Oct 15, 10:05pm, Bart Schaefer wrote:
}
} However, (^foo)(*) could be very useful with backreferences, because
} (^foo) puts everything up to "foo" into $match[1], and then (*) puts
} from "foo" to the end into $match[2].
And now I've got two problems instead of one.
Because of course (^foo) matches "foobar" even though the latter has
"foo" as a prefix. You need (^foo*) to do what I was describing, or
(|^foo) which makes sense only if you either know very little about
regular expressions or you realize that zsh prefers the leftmost of
"|" alternatives over the longest of alternatives.