From 5d58ab8dd88c34a9eaed2c87ef9ef5d8e61e5b15 Mon Sep 17 00:00:00 2001 From: Ingo Blechschmidt Date: Sat, 28 Oct 2017 00:45:04 +0200 Subject: [PATCH] Properly escape curly braces in regular expressions --- sshlatex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sshlatex b/sshlatex index 122366f..8908da5 100755 --- a/sshlatex +++ b/sshlatex @@ -43,15 +43,15 @@ function texdeps { # Of course, this crude heuristic does not cover all cases -- # the general case is intractable, since LaTeX is Turing # complete. :-) - if($line =~ /$commands/ and $line =~ /\\newcommand{?\\(\w+)}?/) { + if($line =~ /$commands/ and $line =~ /\\newcommand\{?\\(\w+)\}?/) { $commands .= "|$1"; } - if($line =~ /\\graphicspath{({.*?})+}/) { + if($line =~ /\\graphicspath\{(\{.*?\})+\}/) { push @dirs, map { "$_/" } grep { length $_ > 0 } split /[{}]/, $1; } - for my $dep ($line =~ /\\(?:$commands)(?:\[[^\]]*\])?{([^}]+)}/) { + for my $dep ($line =~ /\\(?:$commands)(?:\[[^\]]*\])?\{([^\}]+)\}/) { # pdf_t is the default extension for the combined LaTeX/PDF export of xfig for("", qw< .png .jpeg .jpg .pdf .tex .cls .sty .bbl .bib .pdf_t >) { for my $dir (@dirs) {