Take the 2-minute tour ×

In the example below can someone tell me how can i remove the number after no. and use it as a value?

No.311 11/12ozs

share|improve this question
in the example the number would be 311. –  Andy Feb 25 '11 at 15:38

1 Answer 1

up vote 4 down vote accepted
$string = 'No.311 11/12ozs';
preg_match('/No\.([0-9]+)/is', $string, $matches);
// result would be in $matches[1]
share|improve this answer
Wicked thank you. –  Andy Feb 25 '11 at 15:47

Your Answer


