summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorChad Elliott <elliottc@objectcomputing.com>2022-10-14 12:19:08 -0500
committerChad Elliott <elliottc@objectcomputing.com>2022-10-14 12:19:08 -0500
commitb6778ba290a3dade4e3eecbcb7eef3ced94789cb (patch)
tree4e5239c9a3eef6b0374af63228126f015a0fd8dc /modules
parent6540787330dc483d147939dadcc1185c08833d64 (diff)
downloadMPC-b6778ba290a3dade4e3eecbcb7eef3ced94789cb.tar.gz
Temporarily escape new-line characters when creating an array so that regular expressions for splitting the string work properly.
Diffstat (limited to 'modules')
-rw-r--r--modules/StringProcessor.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/StringProcessor.pm b/modules/StringProcessor.pm
index f6da1934..845f684a 100644
--- a/modules/StringProcessor.pm
+++ b/modules/StringProcessor.pm
@@ -82,6 +82,7 @@ sub create_array {
$escaped |= ($line =~ s/\\\t/\04/g);
$escaped |= ($line =~ s/\\\"/\05/g);
$escaped |= ($line =~ s/\\\\/\06/g);
+ $escaped |= ($line =~ s/\n/\07/g);
foreach my $part (grep(!/^\s*$/,
split(/(\"[^\"]+\"|\'[^\']+\'|\s+)/, $line))) {
@@ -98,6 +99,7 @@ sub create_array {
$part =~ s/\04/\t/g;
$part =~ s/\05/\"/g;
$part =~ s/\06/\\/g;
+ $part =~ s/\07/\n/g;
}
## Push it onto the array