I have a list of data all in the same format which I need to analyse in Weka.
I need to surround the date/time values with quotation marks “” but can’t work out a regular expression to complete it..
I need to change a row from this:
1028,NULL,1,21,7,AD9,06A,60136859,NULL,1,4,3,2012-02-21 10:05:00.100,2012-02-21 10:05:23.170
to a row like this:
1027,NULL,1,21,7,AD9,06A,60136859,NULL,1,5,4,"2012-02-21 10:03:53.643","2012-02-21 10:04:29.787"
where the date/time values are surrounded by quotation marks.
This will work in notepad++ as long as your datetime values are always fully formatted.
This works because of backreferences. Everything that is captured within parenthesis is stored as a backreference. You access backreferences by typing
\numberwhere number correlates to the position of parenthesis in the regex. So since we are only using one pair of parenthesis, want backreference 1, and we use\1.So you find the
entire dateand it gets stored in\1because of the parenthesis in your regex. Then you replace theentire datewith"entire date"aka"\1".