sphakka
September 4, 2024, 4:13pm
1
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.
andrii
September 5, 2024, 10:55am
4
Hi,
Please provide more details, is home address a custom attribute or do you use the Geolocation extension?
sphakka
September 5, 2024, 11:49am
5
It’s just a custom (vendor) attribute.
andrii
September 6, 2024, 8:32am
7
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.
system
Closed
October 6, 2024, 8:33am
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.