正则表达式中
单词指的是由字母、数字、下划线组合而成的字符串,用符号表示为w(小写)。
空白符包括单字节空格、双字节空格、制表符,用符号表示为s(小写)。
1.匹配被双引号包含的所有字符串(strings surrounded by double-quotation marks)
".*?"
2.匹配被方括号包含的所有字符串(strings surrounded by [ ])
[[^[]*?]
3.匹配变量名(variable names)
[a-zA-Z_][a-zA-Z_0-9]*
4.删除所有空白行
^s*
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
.*$
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 start 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: <H41>
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
Find: [a-z]
Replace: U
Capitalize all words
Find: ([a-zA-Z])([a-zA-Z]*)
Replace: U1L2