note 108746 modified in function.preg-match by danbrown

From: Date: Tue, 22 May 2012 19:45:32 +0000
Subject: note 108746 modified in function.preg-match by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-188138@lists.php.net to get a copy of this message
Here&#39;s a regex to validate against the schema for common MySQL &#13;&#10; identifiers:&#13;&#10;&#13;&#10;&#60;?php&#13;&#10;$string = &#34;$table_name&#34;;&#13;&#10;if (preg_match(&#34;/[^\\d\\sa-zA-Z$_]/&#34;, $string))&#13;&#10; echo &#34;Failed validation&#34;;&#13;&#10;?&#62; --was-- Here's a regex to validate against the schema for common MySQL identifiers: <? $string = "$table_name"; if (preg_match("/[^\d\sa-zA-Z$_]/", $string)) echo "Failed validation"; ?> http://php.net/manual/en/function.preg-match.php

« previous php.notes (#188138) next »