From: MenTaLguY Date: 2007-04-18T00:44:15+09:00 Subject: Re: Slow ruby regexes On Tue, 17 Apr 2007 23:10:11 +0900, Robert Klemme wrote: > LOL - now I'm confused, too. :-) I was looking for something like (made > up fake): "To prioritize branches of an alternative in sed you do sed -e > 's/foo(!2bar|!1baz)/yummy\1/g'." Of course this does not work with sed > (at least no implementation of sed that I know). Are there other tools > that allow to embed something into a RX that will do this prioritization? OHHHHHHHH. | is a deterministic choice operator, so the branches are prioritized by default -- earlier alternatives take precedence over later ones. Just write your RX alternatives from highest to lowest priority. Does that answer your question? -mental