Hey guys can you help me with this. I've got this '/[^A-Za-z]/' but cannot figure out the punctuations part.
Gracious!
Hey guys can you help me with this. I've got this '/[^A-Za-z]/' but cannot figure out the punctuations part.
Gracious!
/[^A-Za-z]*/ will match everything except letters. You shouldn't need to specify numbers or punctuation.
The regular expression you are using doesn't allow letters; it's the opposite of what you are reported in the title.
/[a-z]/i
is enough, if you want to accept only letters. If you want to allow letters like à, è, or ç, then you should expand the regular expression; /[\p{L}]/ui
should work with all the Unicode letters.
#^[^a-z]+$#i
Your code was correct, you just need ^ and $. So it means all character from the beginning to the end doesn't allow outside alphabet. Negative match is preferred than positive match here.