Blob Blame History Raw
From ead9c5ade86d90b07f778b2fcb972f273d52c3c2 Mon Sep 17 00:00:00 2001
From: Dan Gildea <dgildea>
Date: Thu, 24 May 2018 14:01:34 -0400
Subject: [PATCH] escape var in regexp

Fixes #48
---
 latex2html.pin | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/latex2html.pin b/latex2html.pin
index 116473f..398b3db 100755
--- a/latex2html.pin
+++ b/latex2html.pin
@@ -4627,7 +4627,7 @@ sub balance_tags {
     $save_tags = join(',',@save_open_tags) if (@save_open_tags);
     $open_tags = join(',',@$open_tags_R) if (@$open_tags_R);
     if ($open_tags eq $save_tags) { return(); }
-    if ($save_tags =~ s/^$open_tags//) {
+    if ($save_tags =~ s/^\Q$open_tags\E//) {
 	@reopen_tags = split (',',$');
     } else {
 	@reopen_tags = @save_open_tags;
@@ -4637,7 +4637,7 @@ sub balance_tags {
 	    $declarations{$tag_cmd} =~ m|</.*$|;
 	    $tags .= $& unless ($` =~ /^<>$/);
 	    $open_tags = join(',',@$open_tags_R) if (@$open_tags_R);
-	    last if ( $save_tags =~ s/^$open_tags/
+	    last if ( $save_tags =~ s/^\Q$open_tags\E/
 		     @reopen_tags = split (',',$');''/e);
 	}
     }