Keeping other encodings in mind

The regular expression has a type mismatch when called with types other than string. I think this can be solved, but at the moment that is not of importance I guess