【发布时间】:2012-03-12 12:43:33
【问题描述】:
我的文本以这样的行开头:
[1] some text
[2] another text
[56] third
我需要删除方括号(仅在行首)并保持数字和文本不变,例如:
1 some text
2 another text
56 third
我用记事本++
【问题讨论】:
我的文本以这样的行开头:
[1] some text
[2] another text
[56] third
我需要删除方括号(仅在行首)并保持数字和文本不变,例如:
1 some text
2 another text
56 third
我用记事本++
【问题讨论】:
搜索
^\[(\d+)\]
替换为
\1
^ 是行首的锚点
您必须转义方括号,因为它们在正则表达式中具有特殊含义
\d+ 至少为一位数
由于\d+周围的括号,数字存储在\1中,因此您需要\1作为替换文本。
【讨论】: