1 2 3 4 5 6 7 8 9 10 11
# Ruby has the bare literal, so the slash-versus-division walk runs here NESTED = /(a+)+/ ANCHORED = /^[a-z]+$/i # And a constructor BUILT = Regexp.new('(a|ab)+') # Division, not a regex def ratio(a, b) a / b / 2 end