When trying to verify that a string consists of only alphabetic characters, I get two possible solutions to regular expressions.
The first checks that each character in the string is alphanumeric:
/^[a-z]+$/
The second tries to find a character somewhere in a non- alphanumeric string :
/[^a-z]/
(Yes, I could use character classes here.)
Is there a significant performance difference for long lines? (Anyway, I assume the second option is faster.)
Franz source
share