use lazy match in ruby version