本文主要是介绍Emeditor Regular Expression,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
要注意的是,查找所有,要加上 "." 后面+上“*”Q. What are examples of regular expressions?
- strings surrounded by double-quotation marks
".*?" - strings surrounded by [ ]
/[[^/[]*?/] - variable names
[a-zA-Z_][a-zA-Z_0-9]* - IP addresses
([0-9]{1,3})/.([0-9]{1,3})/.([0-9]{1,3})/.([0-9]{1,3}) - URL
(/S+)://([^:/]+)(:(/d+))?(/[^#/s]*)(#(/S+))? - lines followed by a tab
/t.*$ - Hiragana
[/x{3041}-/x{309e}] - Full-width Katakana
[/x{309b}-/x{309c}/x{30a1}-/x{30fe}] - Half-width Kana
[/x{ff61}-/x{ff9f}] - CJK ideographs
[/x{3400}-/x{9fff}/x{f900}-/x{fa2d}] - CJK ideograph marks
[/x{3000}-/x{3037}] - Hangul
[/x{1100}-/x{11f9}/x{3131}-/x{318e}/x{ac00}-/x{d7a3}] - Insert // at start of lines
Find: ^
Replace with: // - Remove // at end of lines
Find: ^//
Replace: - Remove trailing whitespaces
Find: /s+?$
Replace with: - Replace (abc) with [abc]
Find: /((.*?)/)
Replace: /[/1/] - Replace <H3 ...> with <H4 ...>
Find: <H3(.*?)>
Replace: <H4/1> - Replace 9/13/2003 with 2003.9.13
Find: ([0-9]{1,2})/([0-9]{1,2})/([0-9]{2,4})
Replace: /3/./1/./2/. - Uppercase characters from a to z (EmEditor Professional only)
Find: [a-z]
Replace: /U/0 - Capitalize all words (EmEditor Professional only)
Find: ([a-zA-Z])([a-zA-Z]*)
Replace: /U/1/L/2
Regular Expression Syntax
EmEditor regular expression syntax is based on the Perl regular expression syntax.
Literals
All characters are literals except: ".", "*", "?", "+", "(", ")", "{", "}", "[", "]", "^", "$" and "/". These characters are literals when preceded by a "/". A literal is a character that matches itself. For example, searching for "/?" will match every "?"in the document, or searching for "Hello" will match every "Hello" in the document.
Metacharacters
The following tables contain the complete list of metacharacters (non-literals) and their behavior in the context of regular expressions.
/ | Marks the next character as a special character, a literal, or a back reference. For example, 'n' matches the character "n". '/n' matches a newline character. The sequence '//' matches "/" and "/(" matches "(". |
^ | Matches the position at the beginning of the input string. For example, "^e" matches any "e" that begins a string. |
这篇关于Emeditor Regular Expression的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!