Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以从此正则表达式中获取数字?
preg_match("/STEAM_\d:\d:\d*/", $SteamID, $matches)
我需要将所有三个数字都转换为 vars。
是的。您需要捕获组。
preg_match("/STEAM_(\d):(\d):(\d*)/", $inputStr, $matches); print_r($matches);
如您所见,如果执行该操作,您的数字将位于$matches[1],$matches[2]和$matches[3]. $inputStr如果这种模式在使用中出现多次preg_match_all。
$matches[1]
$matches[2]
$matches[3]
$inputStr
preg_match_all