fork download
  1. <?php
  2. $your_string = 'idiot@idiot.com';
  3. test($your_string);
  4. $your_string = str_replace('@', '(at)', $your_string);
  5. test($your_string);
  6. function test($your_string){
  7. if(preg_match("/[A-Z0-9._%+-]+(@|\(at\))[A-Z0-9.-]{3,65}\.[A-Z]{2,4}/i", $your_string)){
  8. echo $your_string . ': true ';
  9. }else{
  10. echo $your_string . ': false ';
  11. }
  12. }
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
idiot@idiot.com: true  idiot(at)idiot.com: true