From: Brian Candler Date: 2007-05-30T16:31:32+09:00 Subject: Re: Regexp to extract number with hyphen On Wed, May 30, 2007 at 08:15:05AM +0900, bcparanj@gmail.com wrote: > The regexp: /foo\ (\d+)\-?(\d*)/ > seems to work. Still testing... What exactly are the allowed matches? Only num1-num2, or is num1 by itself allowed? What about num1-num2-num3? /foo ([0-9-]+)/ matches .....foo 1-2-3.... and foo 1-2 and foo 1 /foo (\d+-\d+)/ matches .....foo 1-2.... only /foo (\d+(-\d+)?)/ matches .....foo 1-2.... and foo 1, but not foo-1-2-3