notepad ++ Help need to split groups of 4,6,8 digits to groups of 2

Solution 1:

  • Ctrl+H
  • Find what: \b(\d\d)(\d\d)?(\d\d)?\b
  • Replace with: $1(?2 $2)(?3 $3)
  • CHECK Wrap around
  • CHECK Regular expression
  • Replace all

Explanation:

\b              # word boundary, make sure we haven't a digit before
(\d\d)          # group 1, 2 digits
(\d\d)?         # group 2, 2 digits, optional
(\d\d)?         # group 3, 2 digits, optional
\b              # word boundary, make sure we haven't a digit after

Replacement:

$1              # content of group 1, the first 2 digits
(?2 $2)         # if group 2 exists, insert a space and content of group 2
(?3 $3)         # if group 3 exists, insert a space and content of group 3

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here