如何在 sublime text 中使用 Regex select 第二个和第三个逗号之间的特定内容?

How to select specific content between second and third comma using Regex in sublime text?

大家好,我正在尝试 select 使用正则表达式

第二个和第三个逗号之间的内容

这是我的内容

INSERT INTO table (column1, column2, column3) VALUES ('Alejandro', 'dislike', '', 20, 'otro nombre')
INSERT INTO table (column1, column2, column3) VALUES ('Jando', 'like', '', 30, 'wtf')

如您所见,第二个和第三个逗号之间只是单引号 '',我想 select 使用正则表达式对它们进行编辑,因为我需要在 sublime text 3 中修改 5000 行,我希望你能帮助我,我试过没有成功 ,(.*){2} 我知道我错了,我没有使用正则表达式的经验

注意:不是所有时间都是单引号''

使用

 \bVALUES\s(?:[^\n,]*,){2}\h*\K[^,\n]+

proof

说明

\b                       the boundary between a word char (\w) and
                           something that is not a word char
--------------------------------------------------------------------------------
  VALUES                   'VALUES'
--------------------------------------------------------------------------------
  \s                       whitespace (\n, \r, \t, \f, and " ")

--------------------------------------------------------------------------------
  (?:                      group, but do not capture (2 times):
--------------------------------------------------------------------------------
    [^\n,]*                  any character except: '\n' (newline),
                             ',' (0 or more times (matching the most
                             amount possible))
--------------------------------------------------------------------------------
    ,                        ','
--------------------------------------------------------------------------------
  ){2}                     end of grouping
--------------------------------------------------------------------------------
  \h*                      horizontal whitespace (0 or more times 
                           (matching the most amount possible))
--------------------------------------------------------------------------------
  \K                       match reset operator (discarding text matched so far)
--------------------------------------------------------------------------------
  [^,\n]+                  any character except: ',', '\n' (newline)
                           (1 or more times (matching the most amount
                           possible))

另一次尝试:

\bVALUES\s*\((?:\s*'(?:''|[^'])*'\s*,){2}\s*\K'(?:''|[^'])*'

another proof

说明

--------------------------------------------------------------------------------
  \b                       the boundary between a word char (\w) and
                           something that is not a word char
--------------------------------------------------------------------------------
  VALUES                   'VALUES'
--------------------------------------------------------------------------------
  \s*                      whitespace (\n, \r, \t, \f, and " ") (0 or
                           more times (matching the most amount
                           possible))
--------------------------------------------------------------------------------
  \(                       '('
--------------------------------------------------------------------------------
  (?:                      group, but do not capture (2 times):
--------------------------------------------------------------------------------
    \s*                      whitespace (\n, \r, \t, \f, and " ") (0
                             or more times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
    '                        ' char
--------------------------------------------------------------------------------
    (?:                      group, but do not capture (0 or more
                             times (matching the most amount
                             possible)):
--------------------------------------------------------------------------------
      ''                       ''
--------------------------------------------------------------------------------
     |                        OR
--------------------------------------------------------------------------------
      [^']                     any character except: '
--------------------------------------------------------------------------------
    )*                       end of grouping
--------------------------------------------------------------------------------
    '                        '\''
--------------------------------------------------------------------------------
    \s*                      whitespace (\n, \r, \t, \f, and " ") (0
                             or more times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
    ,                        ','
--------------------------------------------------------------------------------
  ){2}                     end of grouping
--------------------------------------------------------------------------------
  \s*                      whitespace (\n, \r, \t, \f, and " ") (0 or
                           more times (matching the most amount
                           possible))
--------------------------------------------------------------------------------
  \K                       match reset operator (discarding text matched so far)
--------------------------------------------------------------------------------
  '                        '
--------------------------------------------------------------------------------
  (?:                      group, but do not capture (0 or more times
                           (matching the most amount possible)):
--------------------------------------------------------------------------------
    ''                       '\'\''
--------------------------------------------------------------------------------
   |                        OR
--------------------------------------------------------------------------------
    [^']                     any character except: '''
--------------------------------------------------------------------------------
  )*                       end of grouping