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('#^(\\w+)( | array )(\\w+)(?:|\\=(.*))$#', $line, $mtch)
文本 :
integer udg_plc = 0 integer array udg_time string array udg_plname player array udg_dlforpl multiboard udg_LastTable= null integer array udg_kill1
结果没有匹配。如何纠正?
这是因为您的输入中有超过 1 个空格
/^(\w+)( +| +array +)(\w+)(?:| +\=(.*))$/
使用+量词匹配 1 到多个空格
+