I'm using this regexp:
/[^+][a-z]/.test(str)
I'm trying to ensure that if there are any letters ([a-z]
) in a string (str
) not proceeded by a plus ([^+]
) , a match is found and therefore it will return true.
It mostly works except when there is only one character in the string. For example, a
returns false, even though there is no plus sign preceding it.
How can I ensure it works for all strings including one character strings. Thanks!