Validate home addresses with diacritics

I need to validate home addresses with diacritics. The regex to be used would be:

/[\p{L}[:alnum:][:space:].,'-]+/u

Maybe \p{L} is redundant with the mandatory (?) u option, cf. this live regex.

How to enforce unicode? Indeed full //u syntax doesn’t seem to work in the attribute form’s “Regex pattern” field.

Hi,

Please provide more details, is home address a custom attribute or do you use the Geolocation extension?

It’s just a custom (vendor) attribute.

Hi,

If this is a custom text attribute, then you need to add PHP compatible regex, without a wrapper (no extra slashes on the sides) hivepress/includes/fields/class-text.php at master · hivepress/hivepress · GitHub.

As a workaround, you can also custom validate the form on hivepress/v1/forms/user_update/errors (if it’s a user profile form) or on hivepress/v1/models/user/errors.

​I hope this is helpful to you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.