我在形式为
的记事本++中有一些简单的销售数据($12 000)
($9 000)
等。等
我想将它们从此表单更改为
-120000
-90000
等
我确定以某种方式使用regex / find-replace是可行的。在记事本++中完成此操作的最佳方式是什么?
Find : (\d)
Replace : -\d
无法让我到任何地方。
任何帮助都非常感激。
答案 0 :(得分:1)
使用此正则表达式:
\((\$\d+\s\d+)\)
将此作为替代品:
-\1
确保选中正则表达式单选按钮。
RegexBuddy为正则表达式生成以下说明:
解释
\((\$\d+\s\d+)\)
Match the character "(" literally «\(»
Match the regular expression below and capture its match into backreference number 1 «(\$\d+\s\d+)»
Match the character "$" literally «\$»
Match a single digit 0..9 «\d+»
Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
Match a single character that is a "whitespace character" (spaces, tabs, line breaks, etc.) «\s»
Match a single digit 0..9 «\d+»
Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
Match the character ")" literally «\)»