bcparanj / gmail.com wrote:
> I have a text with "foo 01-02" in a string. I want to extract foo
> 01-02 using regexp. reg = /foo (\d+)/ only extracts foo with numbers
> when there is no hyphen.
>
> reg = /foo (\d{1,})|(\-)|(\d{1,})/   only extracts foo 01. TIA.
>
>   

Does this work?

/foo (\d+-\d+)/

-- 
RMagick OS X Installer [http://rubyforge.org/projects/rmagick/]
RMagick Hints & Tips [http://rubyforge.org/forum/forum.php?forum_id=1618]
RMagick Installation FAQ [http://rmagick.rubyforge.org/install-faq.html]