http://stackoverflow.com/questions/3512471/non-capturing-group
str = "http://stackoverflow.com/questions/tagged/regex"
str =~ /(http|ftp):\/\/([^\/\r\n]+)(\/[^\r\n]*)?/
puts $1 # => http
# with ?:
str = "http://stackoverflow.com/questions/tagged/regex"
str =~ /(?:http|ftp):\/\/([^\/\r\n]+)(\/[^\r\n]*)?/
puts $1 # => stackoverflow.com
http://stackoverflow.com/questions/13401514/whats-the-profit-of-using
str = "helo world around"
str =~ /(.*)\s/
puts $1 # => helo world
# with ?
str = "helo world around"
str =~ /(.*?)\s/
puts $1 # => helo