替换notepad ++中的字符,但排除单引号内的字符(第4个) [英] replace characters in notepad++ BUT exclude characters inside single quotation marks(4th)

查看:235
本文介绍了替换notepad ++中的字符,但排除单引号内的字符(第4个)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

替换notepad ++中的字符但不能包含字符在单引号内(第二个)

" Jonny 5 "解决了这个问题-但是-如果我有这样的构造:

"Jonny 5" solved this question - BUT - if I have a construct like this:

SELECT column_name FROM table_name WHERE column_name IN ('A' , 'st9u' ,'Meyer', ....);
WHERE    a.object_type IN (' 'TABLE'', ''MATerialIZED VIE3W'   ')
vpl_text := IS_GOING_SMALL_CORRECT

(1) vpl_text := TO_CHAR(vpl_text_old) || '    ' ||...;
-- ------
vpl_text := STAYS_UPPER_ERROR

(2) vpl_text := TO_CHAR(vpl_text_old) || '' ||...;
-- ------

vpl_text := IS_GOING_SMALL_CORRECT

那么目标应该是:

select column_name from table_name where column_name in ('A' , 'st9u' ,'Meyer', ....);
where    a.object_type in (' 'TABLE'', ''MATerialIZED VIE3W'   ')
vpl_text := is_going_small_correct

(1) vpl_text := to_char(vpl_text_old) || '    ' ||...;
-- ------
vpl_text := stays_upper_error

(2) vpl_text := to_char(vpl_text_old) || '' ||...;
-- ------

vpl_text := is_going_small_correct

但是结果是(其余为好吧!):

but the result is (The rest is o.k.!):

:
-- ------
vpl_text := STAYS_UPPER_ERROR

(2) vpl_text := TO_CHAR(vpl_text_old) || '' ||...;
-- ------
:

条件:(与in相同) 替换notepad ++中的字符,但排除单引号内的字符分数(第二)

conditions: (same like in) replace characters in notepad++ BUT exclude characters inside single quotation marks(2nd)

如果我换行(1)和(2),也会发生这种情况!

如何在记事本++中更改此正则表达式,将所有大写字母更改为小写字母-排除单引号内?

推荐答案

以前的正则表达式的实际问题是' '被视为开头分隔符,而整个文本则来自直到''都受到子例程调用的保护".

The actual problem with the previous regex is that ' ' was considered as an opening delimiter, and the whole text from ' ' up to '' was "protected" with the subroutine call.

使用

'\s*(?0)?(?=\w)[^']*'\K|(\w+)

(?=\w)前瞻确保在最里面的开始'之后是单词字符.如果可以再有一个空格,则可以用(?=\s*\w)代替此前瞻.

The (?=\w) look-ahead makes sure that after the innermost starting ' is followed by a word character. If there can be again a space, you may replace this look-ahead with (?=\s*\w).

这篇关于替换notepad ++中的字符,但排除单引号内的字符(第4个)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆