如何分割字符串并在日期之前添加新行?
对于Ex,
$string = 4/25/2011 11:34:07 AM [test] >> Need to change. 5/16/2011 10:44:45 AM [test] >> Nothing to change yet. Need to review information. 5/23/2011 11:13:39 AM [test] >> Working on it.
预期结果:
4/25/2011 11:34:07 AM [test] >> Need to change.
5/16/2011 10:44:45 AM [test] >> Nothing to change yet. Need to review information.
5/23/2011 11:13:39 AM [test] >> Working on it.
我试过
my @words1 = split /\d{2}\\\d{2}\\(?:\d{2}|\d{4})\s+\d{2}:\d{2}/, $str;
但未返回所需的输出