Skip to content

Commit b345448

Browse files
authored
cut: correct delimiter usage in regex (#1055)
* A backslash is a valid field delimiter for cut, but it caused an error here because it was unintentionally interpreted into the regex * Some existing scripts use \Q & \E pair in the regex to avoid this kind of problem; do it here too * This was found when testing against other versions
1 parent 01c2bf9 commit b345448

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

bin/cut

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ sub handle_f {
152152
chomp;
153153

154154
# Only waste time on lines with delimiters
155-
if (/$delim/) {
156-
my @hunk = split /$delim/;
155+
if (m/\Q$delim\E/) {
156+
my @hunk = split /\Q$delim\E/;
157157
my $col = 0;
158158
my @out;
159159
foreach my $c (@cols) {

0 commit comments

Comments
 (0)