我有像這樣的字符串:preg_match_all解析XML類屬性字符串
option_alpha="value" option_beta="some other value" option_gamma="X" ...etc.
我用這個來把它解析爲名稱&值對:
preg_match_all("/([a-z0-9_]+)\s*=\s*[\"\'](.+?)[\"\']/is", $var_string, $matches)
工作正常,除非它遇到一個空屬性值:
option_alpha="value" option_beta="" option_gamma="X"
我在我的正則表達式中做了什麼錯?