note 57929 deleted from ref.regex by nlopess
| From: | nlopess@php.net | Date: | Mon, 12 Jun 2006 21:44:16 +0000 |
| Subject: | note 57929 deleted from ref.regex by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114284@lists.php.net to get a copy of this message | ||
Note Submitter: damian dot capoano at NOSPAM dot gmail dot com
----
That's a cool regex, but it has a catch, matches strings like this:
555)123 4567
A possible workaround could be:
<?php
if((strpos($string, '(') !== false && strpos($string, ')') === false) ||
(strpos($string, '(') === false && strpos($string, ')') !== false))
{
echo "You're missing a bracket.";
}
?>