简体   繁体   English

在notepad ++中使用正则表达式查找和替换变量数字

[英]Finding and replacing variable digits with regular expression in notepad++

I need to replace 16.16.XXX"> with 16.16.XXXA"> , where X represents any digit, using notepad++'s find and replace feature. 我需要使用notepad ++的查找和替换功能将16.16.XXX">替换为16.16.XXXA"> ,其中X代表任何数字。 I just need to add the A but keep the other numbers (the last three digits represented by X are variable). 我只需要添加A但保留其他数字(由X表示的最后三位数是可变的)。

I know little about regexes, but I tried entering 16.16.\\d\\d\\d"> in the "find" field and tried to replace it with 16.16.\\d\\d\\dA"> , but this replaced the variable digits with \\d\\d\\d rather than their original digits. 我对正则表达式知之甚少,但我尝试在“查找”字段中输入16.16.\\d\\d\\d">并尝试将其替换为16.16.\\d\\d\\dA"> ,但这取代了可变数字\\d\\d\\d而不是原始数字。

Use 使用

Find what : (16\\.16\\.\\d{3})(">) 找到(16\\.16\\.\\d{3})(">)
Replace with : $1A$2 替换为$1A$2

Details 细节

  • (16\\.16\\.\\d{3}) - Group 1: 16.16. (16\\.16\\.\\d{3}) - 第1组: 16.16. and any 3 digits ( \\d{3} ) 和任何3位数( \\d{3}
  • (">) - Group 2: "> substring. (">) - 第2组: ">子串。

The $1 and $2 are backreferences that refer to the values captured with the corresponding capturing groups. $1$2是反向引用,指的是使用相应的捕获组捕获的值。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM