Chris Boget wrote:

Why isn't my regex working?  From everything that I've
read, it should be...

<script language="php">

$string = "[joebob]";

if( preg_match( '/\[(\s+)\]/i', $string, $aMatches )) {
 print_r( $aMatches );

} else {
 echo 'No match was found' . "\n\n";

}

</script>

Chris



your regex is matching one or more whitespace characters between [ and ]. i think you wanted \S and not \s. see: http://www.php.net/manual/en/pcre.pattern.syntax.php

Ryan Briones

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to