I need a regular expression to match a-zA-Z0-9
as well as whitespace and special characters, but only including English whitespace/special characters, not those of other languages like French or Spanish.
Thanks.
I need a regular expression to match a-zA-Z0-9
as well as whitespace and special characters, but only including English whitespace/special characters, not those of other languages like French or Spanish.
Thanks.
It's not possible/practical to write a regular expression that matches English, but not French, Spanish and other languages.
If you really want to test if a word is from the English language, you can write some code to look it up in a English dictionary. That should be simple enough.
Depending on the regex engine, you may be able to use:
^\p{IsBasicLatin}*$
To allow only characters in the Basic Latin character set, which includes standard English lanuage punctuation (i.e., the characters that can be directly entered on a U.S. keyboard).
I was looking for a regular expression that would match regular english text (and avoid maybe html/xml/url etc) and landed on this page. I think the questioner just wanted to avoid character with phonetic information in it but allow for english punctuation characters. I ended up writing something by myself looking at my keyboard
[A-Za-z\d,.?;:\'"!$%() ]*
I don't claim this will work for everyone but was good enough for me.