Dave Veeneman <da****@nospam.com> wrote:
If you need to check a set of characters, a regular expression will do the
trick more easily than looping through the characters in the string, testing
each one.
Indeed it will - and in simple cases it may be more easily readable
too. In other cases, however, it'll be less readable as the regular
expression becomes harder to understand to the human eye. Also, using
straight code will be significantly faster, if performance is an issue.
(Performance should only be taken into consideration when it's actually
proved to be problematic.)
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too