You want an explanation of the regular expression? Well, I'm not too handy with them either, but I'll give it a shot.
The \w means "any word character" -- which is any letter of the alphabet or digit.
The \s means "any whitespace character" -- which is spaces and carriage returns.
The | means "or."
The ^ means "starts with" and the $ means "ends with." The "+" means -- well, I'm sure exactly what it means, but I know it works.
It has to do with the middle, anyway.
What happens when you use "^\w+$" is that it will only accept word characters. The other one here -- "^(\w|\s)+$" -- only accepts word or whitespace characters. You can do the same thing with digits -- "^\d+$". You can probably also do it with specific letters, but I haven't tested that out yet. I'm guessing here, but to test whether a string consisted of nothing but vowels, for example, you could probably use "^(a|e|i|o|u)+$".
All of this is trial and error -- lots of trials, most of which end in error.
I usually write little Perl scripts and test them on my home computer to see if the syntax is right.
------------------
JPD