2
I would like to know how to validate categories with regular expressions. So I have a list of categories separated by comma. Each word must have a maximum of 20 characters, I need to validate every comma, if the word has alphanumeric characters.
I need to free up the spaces as I did below, but the category must have at least 1 character, but it cannot be made of space.
nothing , , look --- It can’t happen to stay space between commas.
I started doing so:
^[a-zA-Z0-9 ]{1,20}$
Car, bike, knife, nothing
Does anyone have any idea how I can do that.
But in this example:
Carro automático, moto 125, faca cega, your regular expression will ignore the whole line, is that really what you look for? If you could accept spaces, causingCarro automáticobe an item, you can use this expression:[^,\s][^\,]*[^,\s]*– user3603
So @Gerep , the idea is this, just 1 word per category. See you...
– abcd