在单引号之间复制数据

问题描述

我有以下列表:

select 'ABC','A101',1;
select 'PABC\CE','U101',2;
select 'A-BCXY','P01',3;
select 'UABZUE','PU101',4;
select 'WABCPY','IP1',5;
select 'R-YUABC','2U1',6;
select 'PYRABCQWDES','U1',7;
......
......
(900 lines)

我只想复制单引号中的第一个数据:

'ABC'
'PABC\CE'
'A-BCXY'
'UABZUE'
'WABCPY'
'R-YUABC'
'PYRABCQWDES'

我尝试使用Ctrl+D来复制select和光标键,但无法获取完整的字符串。

enter image description here

解决方法

您需要使用正则表达式。 Sublime Text使用Boost C++ Library Perl Syntax

打开查找面板,并确保选择正则表达式,并且未选择整个单词。将以下正则表达式粘贴到面板中,然后单击查找全部。在整个文档中,将选择每行上“选择”一词后的第一个单引号文字,也将选择单引号。

(?<=select )'([^']*)'

该正则表达式的组成部分是:

(?<=select )    A lookbehind to find the text: "select "
'               Match a single quote (i.e. the beginning quote)
([^']*)         Match any number of characters that are NOT a single quote
'               Match a single quote (i.e. the ending quote)

此变体将执行相同的操作,但不选择单引号。

(?<=select ')([^']*)(?=')

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...