notepad++programmers-notepad

Notepad++ how to add some characters after some commas occurrence?


I have a long insert data sequences text like :

INSERT INTO table (field, field, field, field, field, field, field, field, field, field, field, field, field, field, field, field, field, field, field, field, field, field, field)
VALUES (1, '3110000000', 2, '21/01/2011 12:06', '1016', 1, 2, 'asdddasdsd', 'addasddadsd', 'adadadaddaddssaddaadddddddsadsd', 'asdasdsdsdadsadsadadasd', '06003160485', 'adadasdddaddadddds', '50124', 'asdsdaddad', 'asddasdadsad', '03321807576', NULL, '20110121 12:07:00', 1, NULL, NULL, 22),.....

and I need to reformat this field '20110121 12:07:00' as '2011-01-21 12:07:00'.... how I can add those line character for all inserts quickly maybe considering count of fields separated by commas?

Thanks in advance! Cheers!


Solution

  • Assuming you want to target that literal string in any column, you may use the following find and replace in regex mode:

    Find:    '(\d{4})(\d{2})(\d{2}) (\d{2}:\d{2}:\d{2})'
    Replace: '$1-$2-$3 $4'
    

    Demo

    If you really only want to target the 19th column, then we would need to slightly modify the regex pattern.