I suck at Regular Expressions. I've got a string that can only have letters in it, so all I need is a little function to return true if if only has letters or false if there's a number in it. Thanks
First, any combination of letters and punctuation (eg. "test!_()") would return true in your code example since it passes your test of containing digits, but isn't all letters like the OP wanted
If you use \W instead like you suggested following your example, then "test_1234" would also return true since the word character set is comprised of letters, numbers, and underscore ([a-zA-Z_0-9]) - also not what the OP wanted
In my example, letters and ONLY letters are allowed. So cases such as "test1234" or "test()!!" would indeed return false.
It's worth mentioning that regex varies considerably from one engine to another. For instance, PERL regex is very different from the standard grep regex. Java has its own pecularities, and I imagine that PHP does as well.
One of the most common sources of irregularity is what constitutes a special character class like \w. I rarely use them because of that..I'd rather have a portable understanding in my mind that won't break when I move to another platform. So I tend to create character classes explicitly, as kingjr did in his post.