2013-02-19 112 views

回答

0

一種可能性是使用羣體:

x(\d+)y 

現在,第二組將只包含數字。第一組將是整場比賽。

另一種可能性是使用正向前查找並積極回顧後:

(?<=x)\d+(?=y) 

請注意:+我補充道。這是匹配多位數字所必需的。

檢查它here for x and yhere for y and z

+0

BAM。而已。 – user2086169 2013-02-23 04:24:17

0

您需要使用lookarounds或團體

(?<=x)\d+(?=y) 
----- ---- 
|   |->only checks if y is after a digit(lookahead) 
|->only checks if x is before a digit(lookbehind) 
+0

完美。我只能接受一個答案,而丹尼爾有很好的聯繫。但非常感謝您的快速和正確的答覆。 – user2086169 2013-02-23 04:25:31