fork(1) download
  1. <?php
  2.  
  3. $str = 'DeviceLocation[West12]';
  4. if (preg_match('/\[([A-Za-z0-9!#~?=-]*)]/', $str, $m)) {
  5. print_r($m);
  6. }
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
Array
(
    [0] => [West12]
    [1] => West12
)