Regex - replace characters (commas) between double quotes if the pattern matches

I have this log from the Exchange server

2010-05-20T01: 53: 33.097Z, 12.10.53.144, 12.10.53.200, EXHUB-10.08CCC3F50C35F2D2; 2010-05-20T01: 53: 32.128Z; 0, EXHUB-10 \ Default EXHUB-10, SMTP, RECEPTION, 829888, Norma @ ccc.gov.my, 521647.1 ,, NEAK Subgroup Meeting - Modernizing Labor Skills and Improving Vocational and Technical Training - 2:30 pm Monday May 24th, 2010 ", lee.cheesung @ gmail.com, <>, 00A:

and I used this regex to match and group the pattern;

(\ d {4} - \ d {2} - \ d {2}) (?: [\ \ ] +)? (. \ D +: \ D +: \ D + \ D +) (: [\ W + \ d.] *), (. *?), (. *?), (. *?), (. *?), (. *?), (. *?), (. *?) ,,, (['"] *. ['"]. | *?) (*.?) (*.?) (*.?) (*.?), ((*.?).?.?.?.?.?.? *), (*), (*), (*), (*), (* ), (: (\ d {4} - \ d {2} - \ d {2} \ w \ d {2}: \ d {2}: \ d {2} \ d +) (:.?. \ W +) *) * (*)

In principle, information in the log is separated by a comma. Unfortunately, for the "email subject" field, if the user enters a comma, the log will be displayed in double quotes, such as the above example - a comma in the date format"Monday May 24, 2010"

..... 521647,1 ,, "NEAC Sub-Working Group Meeting - Continuing Education Workforce and Professional Development and Technical Training - 2:30 pm Monday May 24, 2010", lee.keesung @ gmail.com ,. ....

(19- )

+3
3

:

, ... , , .

CSV. CSV - , . CSV, .

Perl, :: CSV.

+5

To use java to use Apache:

http://commons.apache.org/sandbox/csv/

0
source

Source: https://habr.com/ru/post/1778663/


All Articles