$out = $s->nextMatch(); assert($out === array(0 => 'digit', 1 => 4)); assert($s->match() === '4'); assert($s->matchPos() === 4); assert($s->pos() === 5); // this is the final match $out = $s->nextMatch(); assert($out === array(0 => 'digit', 1 => 5)); assert($s->match() === '5'); assert($s->matchPos() === 5); assert($s->pos() === 6); $out = $s->nextMatch(); assert($out === null); $s->reset(); $s->string('01 23;45'); $out = $s->getNext(array('/\\d+/', '/\\s+/')); assert($out === array(0 => 0, 1 => array(0 => '01'))); $s->posShift(2); $out = $s->getNext(array('/\\d+/', '/\\s+/')); assert($out === array(0 => 2, 1 => array(0 => ' '))); $s->posShift(1); $out = $s->getNext(array('/\\d+/', '/\\s+/')); assert($out === array(0 => 3, 1 => array(0 => '23'))); $s->posShift(2); // note we've skipped over the ; $out = $s->getNext(array('/\\d+/', '/\\s+/')); assert($out === array(0 => 6, 1 => array(0 => '45'))); $s->posShift(3); $out = $s->getNext(array('/\\d+/', '/\\s+/')); assert($out === array(0 => -1, 1 => null)); $s->reset();