Extract large number from text: Difference between revisions
Jump to navigation
Jump to search
(Created page with "使用正規表示法 (Regular expression) ,從文章內容中擷取長數字 輸入資料: 使用括弧符號 ( 或 ( ,框住長數字 <pre> (1)aaaa(123456) (2...") |
m (Text replacement - "Category:Text file processing" to "Category:String manipulation") |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
使用正規表示法 ([[Regular expression]]) ,從文章內容中擷取長數字 | 使用正規表示法 ([[Regular expression]]) ,從文章內容中擷取長數字 | ||
輸入資料: 使用括弧符號 ( 或 ( | 輸入資料: 使用括弧符號 ( ) 或 ( ),框住長數字 | ||
<pre> | <pre> | ||
(1) | (1)aaaa(12345) | ||
(2)bbb(1234567) | (2)bbb(1234567) | ||
(3)ccc(123456789) | (3)ccc(123456789) | ||
| Line 10: | Line 10: | ||
預期結果 | 預期結果 | ||
<pre> | <pre> | ||
12345 | |||
1234567 | 1234567 | ||
123456789 | 123456789 | ||
| Line 21: | Line 21: | ||
# Replace With: {{kbd | key = <nowiki>\1</nowiki>}} | # Replace With: {{kbd | key = <nowiki>\1</nowiki>}} | ||
[[Category:Regular expression]] [[Category:Data Science]] [[Category: | [[Category:Regular expression]] [[Category:Data Science]] [[Category:String manipulation]] | ||
Latest revision as of 19:35, 9 March 2021
使用正規表示法 (Regular expression) ,從文章內容中擷取長數字
輸入資料: 使用括弧符號 ( ) 或 ( ),框住長數字
(1)aaaa(12345) (2)bbb(1234567) (3)ccc(123456789)
預期結果
12345 1234567 123456789
使用支援正規表示法的文字編輯器,例如 Sublime Text 。操作步驟
- 選單 File -> Replace
- 啟用 Regular expression
- Find What: .*[\(|(](\d\d+)[\)|)].*
- Replace With: \1