替换记事本++中的字符但排除单引号内的字符(2nd)
replace characters in notepad++ BUT exclude characters inside single quotation marks(2nd)
对已经回答了第一个类似问题的所有用户(尤其是 Avinash Raj)表示抱歉 - 我只是忘记了第二种字符串。
(而且(那是可悲的事情)-我无法将第一个类似问题的解决方案调整为第二类字符串...)
我有两个不同的字符串:
SELECT column_name FROM table_name WHERE column_name IN ('A' , 'st9u' ,'Meyer', ....);
WHERE a.object_type IN (' 'TABLE'', ''MATEerialIZED VIE3W' ')
我想从上到下替换notepad++中的所有字符,但不包括替换字符
单引号。
condition: It exists no solid structure before/behind/between the single quotation marks part!
(That means - I can not use the
keyword "IN" or signs like "," or "(" or ")" or ";" for this regex
...!)
The once thing is, that two structures for single quotation marks are possible:
'Word|Number' or ''Word|Number''
(but, as shown in 2nd example, with different number of spaces between every single quotation mark!).
目标字符串(单引号内的字符必须保持不变):
select column_name from table_name where column_name in ('A' , 'st9u' ,'Meyer', ....);
where a.object_type in (' 'TABLE'', ''MATerialIZED VIE3W' ')
如何在记事本++中排除单引号部分(替换)?
可以组合一个recursive part for getting '
... '
.... abc
''
and use \K for resetting after. This is the part that needs to be skipped. And using kind of the trick,匹配管道中剩余的单词:
'\s*(?0)?[^']*'\K|(\w+)
(?0)?
这里的模式可以选择从头开始粘贴
\s
是 shorthand 用于 空白字符 [ \t\r\n\f]
\w
是字字符的缩写 [A-Za-z0-9_]
并替换为 \L
以降低在第一个捕获组中捕获的词或 \U
以提高。
使用您的示例数据在 NP++ 6.7.9.2 中为我工作。 See regex101 用于测试模式。
对已经回答了第一个类似问题的所有用户(尤其是 Avinash Raj)表示抱歉 - 我只是忘记了第二种字符串。 (而且(那是可悲的事情)-我无法将第一个类似问题的解决方案调整为第二类字符串...)
我有两个不同的字符串:
SELECT column_name FROM table_name WHERE column_name IN ('A' , 'st9u' ,'Meyer', ....);
WHERE a.object_type IN (' 'TABLE'', ''MATEerialIZED VIE3W' ')
我想从上到下替换notepad++中的所有字符,但不包括替换字符 单引号。
condition: It exists no solid structure before/behind/between the single quotation marks part!
(That means - I can not use the keyword "IN" or signs like "," or "(" or ")" or ";" for this regex ...!)
The once thing is, that two structures for single quotation marks are possible: 'Word|Number' or ''Word|Number'' (but, as shown in 2nd example, with different number of spaces between every single quotation mark!).
目标字符串(单引号内的字符必须保持不变):
select column_name from table_name where column_name in ('A' , 'st9u' ,'Meyer', ....);
where a.object_type in (' 'TABLE'', ''MATerialIZED VIE3W' ')
如何在记事本++中排除单引号部分(替换)?
可以组合一个recursive part for getting '
... '
.... abc
''
and use \K for resetting after. This is the part that needs to be skipped. And using kind of the trick,匹配管道中剩余的单词:
'\s*(?0)?[^']*'\K|(\w+)
(?0)?
这里的模式可以选择从头开始粘贴\s
是 shorthand 用于 空白字符[ \t\r\n\f]
\w
是字字符的缩写[A-Za-z0-9_]
并替换为 \L
以降低在第一个捕获组中捕获的词或 \U
以提高。
使用您的示例数据在 NP++ 6.7.9.2 中为我工作。 See regex101 用于测试模式。