in reply to Regex with Backslashes

Text::CSV may be helpful for your problem.

#!/usr/bin/perl use strict; use warnings; use Text::CSV; my $data = <<'EOF'; 1 Something\,\text\text\0x2B X 99 1,This is a problem->\\,B,2 EOF open my $fh, '<', \$data; my $csv = Text::CSV->new({sep_char => ','}); while (my $row = $csv->getline($fh)) { print "<$_> " foreach @$row; print "\n"; } __DATA__ <1> <Something\> <\text\text\0x2B> <X> <99> <1> <This is a problem->\\> <B> <2>

Greetings,
-jo

$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$

Replies are listed 'Best First'.
Re^2: Regex with Backslashes
by haukex (Archbishop) on May 17, 2020 at 15:03 UTC

    Good point, although the way I understand the question, you'd need to supply the escape_char=>"\\" option.

      Looks like I confused input, actual output and desired output.

      Greetings,
      -jo

      $gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$