EmEditor正则表达式例子

正则表达式中

单词指的是由字母、数字、下划线组合而成的字符串,用符号表示为\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*\n

 

 

 

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 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: <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
Find: [a-z]
Replace: \U\0
Capitalize all words
Find: ([a-zA-Z])([a-zA-Z]*)
Replace: \U\1\L\2

转载于:https://www.cnblogs.com/niaomingjian/p/5099798.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值