2017-08-24 131 views

回答

2

匹配以$string = "[email protected][Y](type:NUM)"

preg_match("/.*@\[(.*)\]\(type:(.*)\)/",$string,$matches); 

Y:$匹配[1] NUM:$匹配[2]

0

我覺得這是你

之後是什麼
/(.)@\[(.)\](.+type:)(.+)(.)/ 

See it here

第一捕獲組(。) 。匹配任何字符 @字符@字面上匹配 [字符[字面上

第二捕獲組(。) 匹配。匹配任何字符 ]的字符匹配]字面上

第三捕獲組(。+型:) 。+ 匹配任何字符

第四捕獲組(+) 。+ 匹配任何字符

5th捕獲組(。) 。任何字符