Extract large number from text

From LemonWiki共筆
Revision as of 11:58, 18 November 2016 by Planetoid (talk | contribs) (Created page with "使用正規表示法 (Regular expression) ,從文章內容中擷取長數字 輸入資料: 使用括弧符號 ( 或 ( ,框住長數字 <pre> (1)aaaa(123456) (2...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

使用正規表示法 (Regular expression) ,從文章內容中擷取長數字

輸入資料: 使用括弧符號 ( 或 ( ,框住長數字

(1)aaaa(123456)
(2)bbb(1234567)
(3)ccc(123456789)

預期結果

123456
1234567
123456789

使用支援正規表示法的文字編輯器,例如 Sublime Text 。操作步驟

  1. 選單 File -> Replace
  2. 啟用 Regular expression
  3. Find What: .*[\(|(](\d\d+)[\)|)].*
  4. Replace With: \1