[nycphp-talk] Reg expression to make sure something is not blank
Jerry Kapron
nyphp at NewAgeWeb.com
Wed Sep 17 15:07:12 EDT 2003
> Jerry Kapron wrote:
> I would use '^.+$'
> Jerry
Well.. it's a regular expression to match a non-empty string, but in real
life you definitely shouldn't use regular expressions for something that
simple.
Dave's example not only makes your code much clearer, but also executes many
times faster than a single regex function. Regular Expressions are
relatively CPU-intensive and if overused, can considerably diminish your
application's performance, especially on a busy server. Use them only if one
or two simple string functions can't do the job.
Be careful... regular expressions are like drugs - it feels good when you
use them.. they can easily become an addiction, and they sure can kill (a
server or two).
I learned the hard way.
cheers,
Jerry
-----Original Message-----
Is this "kosher" for determining that something has not be left blank?
'/^[^^$]{1,35}$/i',
Jeff Siegel
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
More information about the talk
mailing list