2011-06-04 35 views
0

以下是我有的字符串,我想使用正則表達式讀取數字「10」(last(()內)。我正在使用Javascript。請求JavaScript模式的正則表達式

「考驗我234和(另一人)和測試(10)」

+0

一個很好的資源,學習正則表達式:HTTP://www.regular-expressions 。信息/ – 2011-06-04 10:11:30

回答

2

事情是這樣的:

var str = "test me 234 and the (another) and test (10)"; 
result = str.match(/\((\d+)\)$/); 
console.log(result[1]);