Friday, November 9, 2007

What are good techniques for Ruby Regular expressions?

using global variables (perl style):
if uri =~ /^druby:\/\/(.*?):(\d+)(\?(.*))?$/
host = $1
port = $2.to_i
option = $4
using square brackets:

imagelist = f[/ImageList.*?\((.+?)\)/, 1]