From: Armin Roehrl Date: 2004-04-14T07:43:18+09:00 Subject: Re: New Ruby questions... > >1. How can a regexp get the longer of two possibilities that are >ambiguous? For example, I need to be able to strip out register names: > >registers = '(r0|r1|r2|r3...|r10|r11|r12...)' > >In the regular expression, how can I get it to find r10 or r11 instead of >stopping at r1? > register =~ /(r\d{2,})/ p $1 #-> r10 \d is for a digit character {m,n} at least m and at most n repetitions of the preceding more info: http://dev.faeriemud.org/ruby-uguide/uguide05.html http://www.rubycentral.com/ref/ref_c_regexp.html