Google

def match pattern, consume=false md = pattern.match @buffer @buffer = $' if consume and md return md end