$re = '/(?m)^\(?([a-zA-Z]{1,4}[\)\.]|(XC|XL|L?X{0,3}|xc|xl|l?x{0,3})(IX|I?V|V?I{0,3}|ix|i?v|v?i{0,3})[\)\.]|([\dx]{1,3}\.){0,3}[\dx]{1,3})(?:[ \t]+)(\S.*)$/';
$str = '
Hello, world
1.1.1 Great dude
A) Awesome
That\'s it?
ix. Sweet
BBB. Hello
CC) t
D) ere
() ere
There is no way to know whether you are (i) a monkey, (ii) going to become a monkey, and (iii) will have a monkey.
AB. Wrong!
Agreement, by the contractor
As, by
a, by
AAAA) b
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php