It's a META-LANGUAGE PROBLEM!! Everyone DUCK!!! ............................ quack, quack
Here's a third way of quoting that, unlike ' and " completely disables
the special properties of \.
It's a version of a "here-document" and it's documented in perlop.
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11116857 use warnings; my $text = <<'END'; # this quoting method disables special properties +of \ 1,Something\,\\text\\text\0x2B,X,99,\,\\,\\\,foobar END chomp $text; print "input:\n$text\n"; my @fields = split /(?<!\\),|(?<=\\\\),/, $text; print "\noutput:\n"; for ( @fields ) { print "$_\n"; }
Outputs:
input: 1,Something\,\\text\\text\0x2B,X,99,\,\\,\\\,foobar output: 1 Something\,\\text\\text\0x2B X 99 \,\\ \\\ foobar
Is this output a correct solution to your problem?
In reply to Re^5: Regex with Backslashes
by tybalt89
in thread Regex with Backslashes
by anita2R
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |