简体   繁体   中英

Preg_match with regular expressions?

Im trying to catch a posted variable with name that begins with 'price' and ends with a number 0-9 and save the number in a variable $matches . For some reason, the code i have isnt catching it, so obviously my syntax is off. Heres my code..

elseif (preg_match('price/[1-9]/', $field_name, $matches)) {
preg_match('/^price([0-9])$/', $field_name, $matches)

$matches[1]将为您提供数字。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM