I would like to have a regular expression that checks if a string contains only upper and lowercase letters, numbers, and underscores.
For those of you looking for unicode alphanumeric matching, you might want to do something like:
^[\p{L} \p{Nd}_]+$
Further reading at http://unicode.org/reports/tr18/ and at http://www.regular-expressions.info/unicode.html