What’s wrong with this set of RegEx /^[\p{L}\p{N}]+/u. When my senior entered % openminded The regex return false. I need it to accept this format
% openminded
100% openminded
openminded 100%
What do I need to add in the expression? So that it will accept the input even if the user entered % at first or any special character.
The percent sign is not a
\pSsymbol. It’s a\pPpunctuation, as explained by uniprops:You should familiarize yourself with the general category (and perhaps script) that your favorite characters belong to. Here’s some sample output from running unichars:
So either add the right general category to your class, like
or just add the specific character you need. BTW, anything that wants
\pLalmost always also wants\pM, too.