On Wed, Dec 4, 2013 at 6:08 PM, Stuart Clarke <lists / ruby-forum.com> wrote:
> Jesus - this still returns all strings for me in Ruby 1.9.

Works for me in 1.9 too:

1.9.3p448 :027 > re = /\/software\/([^\/]*)\/Microsoft\/Windows
NT\/CurrentVersion$/
=> /\/software\/([^\/]*)\/Microsoft\/Windows NT\/CurrentVersion$/
1.9.3p448 :028 > strings = ["/software/$$$PROTO.HIV/Microsoft/Windows
NT/CurrentVersion",
"/software/CMI-CreateHive{199ADFC2-6E16-4946-BE90-5A3EC3A60902}/Wow6432Node/Microsoft/Office/12.0/UserSettings/Word_Core/Delete/Software/Microsoft/Windows
NT/CurrentVersion",
"/software/CMI-CreateHive{199ADFC2-6E16-4946-BE90-5A3EC3A60902}/Microsoft/Windows
NT/CurrentVersion"]
 => ["/software/$$$PROTO.HIV/Microsoft/Windows NT/CurrentVersion",
"/software/CMI-CreateHive{199ADFC2-6E16-4946-BE90-5A3EC3A60902}/Wow6432Node/Microsoft/Office/12.0/UserSettings/Word_Core/Delete/Software/Microsoft/Windows
NT/CurrentVersion",
"/software/CMI-CreateHive{199ADFC2-6E16-4946-BE90-5A3EC3A60902}/Microsoft/Windows
NT/CurrentVersion"]
1.9.3p448 :029 > strings.each  {|s| (m = re.match(s)) && puts(m.captures)}
$$$PROTO.HIV
CMI-CreateHive{199ADFC2-6E16-4946-BE90-5A3EC3A60902}
 => ["/software/$$$PROTO.HIV/Microsoft/Windows NT/CurrentVersion",
"/software/CMI-CreateHive{199ADFC2-6E16-4946-BE90-5A3EC3A60902}/Wow6432Node/Microsoft/Office/12.0/UserSettings/Word_Core/Delete/Software/Microsoft/Windows
NT/CurrentVersion",
"/software/CMI-CreateHive{199ADFC2-6E16-4946-BE90-5A3EC3A60902}/Microsoft/Windows
NT/CurrentVersion"]


> Anmar - I will try your suggestion. Was keen to keep a regex.

His solution is using a regex too :).


Jesus.