- preg_match: documentation ( source)
- print_r: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$str = "abc pqrs-1/2&3uvw xyz";
if (preg_match('~([a-z]+)((?:[^0-9a-z][0-9])+)([a-z]+)~', $str, $matches)) {
preg_match_all('~[^0-9a-z][0-9]~', $matches[2], $x);
$matches[2] = $x[0];
}
print_r($matches);