OSX系统Atom编辑器多正则匹配结果提取与复制粘贴咨询
How to Extract Z-Starting Terms in Atom (OSX)
First, let's fix the regex issue: your original ^Z\d.* targets lines starting with Z, which doesn't work here because your target terms are in the middle of a single line. Instead, use \bZ\d\w* to match words that start with Z, followed by a digit, then any number of letters/digits.
Required Tools (No Extra Plugins Needed!)
Atom's built-in Find and Replace functionality is all you need—no additional plugins required.
Step-by-Step with Shortcuts:
- Open your file in Atom: Load the document containing the text
b Z1a a Z2ab c Z3abc d. - Open the Find Panel: Press
Cmd + Fto bring up the search bar. - Enable Regex Mode: Click the
.*icon in the Find Panel, or use the shortcutAlt + Cmd + R. - Enter the corrected regex: Type
\bZ\d\w*into the search field. You should see each Z-term highlighted in your text. - Select all matches: Press
Cmd + Option + Enter—this will select every occurrence of the regex in your file (Z1a, Z2ab, Z3abc). - Copy the selected text: Press
Cmd + Cto copy the highlighted terms. - Create a new file: Press
Cmd + Nto open a blank new document. - Paste the copied terms: Press
Cmd + Vto paste the Z-terms into the new file. - Save the new file: Press
Cmd + Sto save it wherever you'd like.
Quick Regex Breakdown:
\b: Denotes a word boundary (ensures we don't match partial words)Z: Matches the literal "Z" character\d: Matches any single digit\w*: Matches zero or more letters, digits, or underscores (perfect for your Z1a-style terms)
内容的提问来源于stack exchange,提问作者cannin
相关产品推荐
相关产品推荐

