PHP regexp find digits without quotes? -


i need regexp in php wich find digits without quote wrapping example: find this: text 1234 text don`t touch this: text "some text 1234 text", , strings should passed to: "1234" or " 123 " etc.

i have 1 incomplete desision:

preg_match_all('/\b\d+\b/', $str, $matches); 

ive tried [^\"|\']+ didnt work out.

you can use php assertions:

http://php.net/manual/en/regexp.reference.assertions.php

preg_match_all("/\d+(?!')/s", $str, $matches); 

Comments