Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Why approximate pattern doesn't match?



On May 10,  7:29pm, Sebastian Gniazdowski wrote:
}
} What's interesting is that this (doing ${a//(#a1)a|(#a1)b|...}) is
} painfully slow when compared to *~^* and :#, it works slower for 25
} elements than :# works for 5000.

As Mikael pointed out, ~^ is "and", whereas | is "or" -- for the "or"
case you have to compare every possibility to every array element, but
for the "and" case you can rapidly discard elements that don't match
the initial pattern.  It's not quite O(n*m) vs. O(n) but is in that
ballpark.



Messages sorted by: Reverse Date, Date, Thread, Author