Re: Only allowing alphanumeric characters and '_' and '-'

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



KH wrote:
I usually avoid regex's because of performance. In this case I haven't tested but would imagine the difference is approximatly "who cares" ... nonetheless I just think of regex's as overkill in many situations where people try to use them.

Usually fewer lines of code is what is most cost effective overall.

Regex is simple code (and if the reader knows regex as a general concept
it is even easy to read) and code that is easy to modify to different
requirements.

It does come with a certain overhead. It may not be suited for
being called billions or trillions of times. But I doubt that was
the case here (the variable was named 'username').

Arne
.



Relevant Pages