Perl multiline regex in windows
✔ Recommended Answer
If the issue is having newlines in the wrong place, either multiple newlines in a row, or before a <
, you may get away with something simple like this:
use strict;use warnings;my $str = do { local $/; <DATA> };$str =~ s/(?=[<])//g;print $str;__DATA__181221533;<valor>0</valor></vars>;889;6;85;112;01/01/2019;29/05/2019 17:17:48182652972;</vars>;-1;8;57217;57228;01/01/2019;06/06/2019 22:20:48182652984;</vint></vars>;0;;0;41;01/01/2019;06/06/2019 22:31:22182652988; </vint></vars>;0;;0;85;01/01/2019;06/06/2019 22:37:36
(I shortened the input to make it readable)
Output:
181221533;<valor>0</valor></vars>;889;6;85;112;01/01/2019;29/05/2019 17:17:48182652972;</vars>;-1;8;57217;57228;01/01/2019;06/06/2019 22:20:48182652984;</vint></vars>;0;;0;41;01/01/2019;06/06/2019 22:31:22182652988; </vint></vars>;0;;0;85;01/01/2019;06/06/2019 22:37:36
Source: stackoverflow.com
Answered By: TLP
Comments
Post a Comment