我正在尝试使用 Notepad++ 将一些带有 - 符号的数字替换为其他格式
例如
-4399.10 changed to 439910}
4399.10 changed to 439919{
-2303.29 changed to 230329}
2303.29 changed to 230329{
all negative signs will be changed to } symbol from right
all positive will be replaced with {
谢谢
最佳答案
在 Notepad++ 中使用条件替换
Find what
:(?<negative>-)?(\d+(\.\d+)?)
Replace with
:\2?{negative}}:{
\2?{negative}}:{
\2 the captured number without sign in group 2
?{negative} if group negative (negative sign) is matched
} character }
: else
{ character {
命名组是可选的,即 \2?{1}}:{
甚至\2?1}:{
工作原理是一样的。
请记住修改“查找内容”中的正则表达式以完全匹配您的格式。
关于replace - 使用Notepad++将数字替换为某种格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40209923/