The third argument to preg_match is the output parameter that collects your captures, i.e. matching strings that match. Use those to feed your objects. Stanzas will not accept regular expressions, but entries will contain the actual matched text that is contained in your line. Use brackets to perform captures.
For example (not tried, but to get the idea):
$str = 'aaabbbaaa'; preg_match('/(b+)/', $str, $regs ); // now, $regs[0] holds the entire string, while $regs[1] holds the first group, ie 'bbb' // now feed $regs[1] to strpos, to find its position
source share