fork(1) download
  1. <?php
  2. //check without beginn and end.
  3. preg_match("/[a-zA-Z0-9\-_$]+/", 'Hello"', $matches);
  4. print_r($matches);
  5.  
  6. //check with beginn and end.
  7. preg_match("/^[a-zA-Z0-9\-_$]+$/", 'Hallo"', $matches);
  8. print_r($matches);
  9.  
  10. if (!preg_match("/^[a-zA-Z0-9\-_$]+$/", 'Hello"')) {
  11. echo 'not valid';
  12. }
Success #stdin #stdout 0.02s 23796KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Hello
)
Array
(
)
not valid