regex - extract order id from a string using preg match in php -



regex - extract order id from a string using preg match in php -

i have parsed email body string in php. in email there lot of information. need extract order id best possible method. line is:

order id: 123456789

it numbers. length varies.

thank help

you can seek using following.

preg_match('/order\s*id:\s*([0-9]+)/i', $string, $id); echo $id[1];

working demo

php regex preg-match

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -