note 87364 deleted from function.preg-match by danbrown
| From: | danbrown@php.net | Date: | Tue, 02 Dec 2008 14:50:33 +0000 |
| Subject: | note 87364 deleted from function.preg-match by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147525@lists.php.net to get a copy of this message | ||
Note Submitter: Madbreaks
----
@Ronen, et al
It's good practice to avoid creating back-references if you're not going to use them. Do
so by replacing '(' with '(?:'.
Also, the final {1} is redundant since any match is matched exactly once by default (had to split
lines due to line length limitation by php.net) -
/^
(?:(?:1?\d{1,2}|2[0-4]\d|25[0-5])\.){3}
(?:1?\d{1,2}|2[0-4]\d|25[0-5])
$/
Nice regex though....are we having fun yet?