Re: Validating Data
Date: Fri, 24 Feb 2012 06:41:10 +0000 (UTC)
Message-ID: <pan.2012.02.24.06.41.10_at_gmail.com>
On Thu, 23 Feb 2012 06:51:33 -0800, ExecMan wrote:
> Hi,
>
> We have a stored procedure called from a PHP web application. The
> parameters received are of VARCHAR2, but we've seen non-printable
> characters come through, which throw errors.
>
> If there any type of RegExp of anything I can run to detect if the
> parameter contains non-ascii characters? (Granted, application should
> check this before sending it to the database, but I did not write the
> application).
>
> Thanks!
With all due respect, why would you use a database for such thing? Oracle
has regexp functions but PHP as a scripting language, loosely based on
Perl has a really good implementation of a very recent PCRE version.
What you need is here:
http://us.php.net/manual/en/regexp.reference.character-classes.php
The class that you need is [:print:] which includes all printable characters. I imagine that a scripting language, purposely built to be similar Perl, must process characters much faster than a database.
-- http://mgogala.byethost5.comReceived on Fri Feb 24 2012 - 00:41:10 CST