fork download
  1. <?php
  2.  
  3. $re = '~\[([a-zA-Z]+):(\d+)]~';
  4. $str = 'this is some text [propertyFromId:34] and this is more text';
  5. preg_match_all($re, $str, $matches);
  6. print_r($matches);
Success #stdin #stdout 0s 82944KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => [propertyFromId:34]
        )

    [1] => Array
        (
            [0] => propertyFromId
        )

    [2] => Array
        (
            [0] => 34
        )

)