Skip to content

Instantly share code, notes, and snippets.

@joubertredrat
Created December 6, 2013 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joubertredrat/7824139 to your computer and use it in GitHub Desktop.
Save joubertredrat/7824139 to your computer and use it in GitHub Desktop.
Desse jeito funciona
<?php
$str = '[0710:020602938:7041]';
switch(true) {
case preg_match('/^(\[)[A-Z0-9]{4}:(' . rand(10000,29999) . '|' . rand(50000,99999) . '):[A-z]{3}(\])(.*)+/', $str);
echo 'a';
break;
case preg_match('/^(\[)[A-Z0-9]{4}:[0-9]{9}:[0-9]{4}(\])+/', $str);
echo 'b';
break;
default:
echo 'c';
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment