V::alpha() validator and non english abecedaries?

Do we have a V::alpha() kind of validator that accepts letters from spanish, german… abecedaries ? or do we have to write our own regex? I am pretty sure there are a few laying around the net, but perhaps this has already been addressed in kirby.

In my tests, V::alpha() does not pass ‘ñ’ for example, most probably by design.

Thank you

You can use own pattern with V::match() method like following sample for unicode chars:

V::match('uñicode', '/^\pL+$/u');

@lukasbestle Maybe V::alpha() validation would be better with a second parameter that supports unicode?

V::alpha('uñicode', true);
1 Like

Thank you @ahmetbora.

When you say ‘unicode chars’ what do you refer to exactly ? As far as I can read, this won’t pass unicode chars such as @ or &. Would you be so kind as to briefly explain your regex please?

Thank you

And, while I am unsure about the intended general use of the validators, if the use involves validating alphabet based linguistic input, it would certainly be useful to have a pre-built validator that accepts alphabets other than english.

There is at least one question on the forum refering to this for K2 here →

There are regex patterns to support Unicode characters.

References

1 Like

@plagasul The issue solved?

Yes, that would be awesome!

1 Like

So here we go :rocket:

1 Like