Блокнот ++ регулярные репрессии, регулярные поиск и замена - PullRequest
0 голосов
/ 25 января 2020

У меня есть текстовый файл базы данных, значения разделены знаком ","

2214, Bunny_Band, Bunny Band, 4,20,, 100 ,, 2,, 0 , 0xFFFFFFFF, 7,2, 1024 ,, 0,1,15, {}, {}, {}

, и я бы изменил 9-е значение до 0, где 15-е значение равно 1024

1 Ответ

0 голосов
/ 25 января 2020
  • Ctrl + H
  • Найти что: ^(?:[^,]*,){8}\K[^,]*(?=(?:,[^,]*){5},1024,)
  • Заменить на: 0
  • CHECK Обтекание
  • CHECK Регулярное выражение
  • Заменить все

Объяснение:

^                   # beginning of line
  (?:[^,]*,){8}     # non capture group, 0 or more non comma followed by comma, must appear 8 times
  \K                # forget all we have seen until this position
  [^,]*             # 0 or more non comma
  (?=               # positive lookahead, make sure we have after:
    (?:,[^,]*){5}       # 5 times a comma followed by 0 or more non comma
    ,1024,              # number 1024 surounded by comma
  )                 # end lookahead

Снимок экрана (до):

enter image description here

Снимок экрана (после):

enter image description here

...