"z u i u" =~ /(z|u|\s)+?/ will match "z". The "?" enforces a "minimal" match (whereas by default a "greedy" match is done)! Regards Clemens > -----Ursprgliche Nachricht----- > Von: Dave Thomas [mailto:Dave / PragmaticProgrammer.com] > Gesendet am: Dienstag, 7. August 2001 14:50 > An: ruby-talk / ruby-lang.org > Betreff: [ruby-talk:19288] Re: re > > stesch / no-spoon.de (Stefan Scholl) writes: > > > irb(main):001:0> "z u i u" =~ /(z|u|\s)+/ > > 0 > > > > First match on position 0. But $1 is " " instead of "z". > > The regexp matches "z u ", so it starts at position 0. > > The last parenthesized expression matched the final space. > > > > Dave >