I am seeking to creating a one line script that creates a string of a specified length with entirely random UTF-8 characters with some special characters excluded. I would like to avoid having a list all available UTF-8 characters.
The regex I would like all characters to match which appears to be PHP specific is: ^[\p{L}0-9]+
Doesn't match: %/.,@[^?!\$]+'`"
Matches: 漢字, зклмнпрстфхцчшщ, דזשודעזמאָ, فارسی
I have taken a look at randexp.js; however, trying my regex, possibly because it's PHP specific yields questionable results.
My question is two fold. What regex can I use in JavaScript to get the same results regex validation results? And how can I generate a random string of UTF-8 characters based off all available characters while still excluding some?
Aucun commentaire:
Enregistrer un commentaire