[ create a new paste ] login | about

Link: http://codepad.org/tBVBiCzH    [ raw code | fork ]

PHP, pasted on Aug 17:
<?php

$s = array(
    'abc950',
    'def100',
    'abc1',
    'df100',
    'abcc100',
    'def1000',
    'a0',
    'df0'
);
$matches;
$regex = '/(abc|def)(([0-9])|([0-9][0-9]{0,1})|([0-8][0-9]{0,2})|(900))($|[^0-9]';

for ($i = 0, $l = count($s); $l < $i; $i++) {
    preg_match_all($regex, $s[$i], $matches);

    var_dump($matches);
}

?>


Output:
No errors or program output.


Create a new paste based on this one


Comments: