cómo reemplazar la cuarta aparición de | con espacio en cada fila en el bloc de notas++

cómo reemplazar la cuarta aparición de | con espacio en cada fila en el bloc de notas++

Tengo los siguientes datos aleatorios enormes.

1231286234|453|1234|xxx|aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx| aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx |aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx | aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv

las líneas son enormes y los datos son aleatorios, quiero que sean como

1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv    
1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv

Respuesta1

Esto funciona para la muestra que ha proporcionado.

Find what: (\w*\|\w*\|\w*\|\w*)([\|\s]*)([\w\|]*)
Replace with: \1 \3

Search mode: Regular expression

Ejemplo

Respuesta2

  • Ctrl+H
  • Encontrar que:^(?:[^|]+\|){3}.*?\K\h*\|\h*
  • Reemplazar con: <-- un espacio
  • CONTROLAR Envolver alrededor
  • CONTROLAR Expresión regular
  • DESMARCAR . matches newline
  • Replace all

Explicación:

^               # beginning of line
  (?:           # start non capture group
    [^|]+       # 1 or more non pipe
    \|          # a pipe, have to be escaped as it's special character for regex
  ){3}          # end group, must appear 3 times
  .*?           # 0 or more any character but new line, not greeedy
  \K            # forget all we have seen until this position
  \h*           # 0 or more horizontal spaces
  \|            # a pipe, have to be escaped as it's special character for regex
  \h*           # 0 or more horizontal spaces

Captura de pantalla (antes):

ingrese la descripción de la imagen aquí

Captura de pantalla (después):

ingrese la descripción de la imagen aquí

información relacionada