Should pattern be a string_ref? We may not have fully string_ref-ified the existing functions yet, but I think probably anything new that we add should use string_ref where applicable.