Skip to content

Commit

Permalink
Add $ and ^ to list of characters to escape in regex.
Browse files Browse the repository at this point in the history
The escape_string method did not include ^ and $ in the list of
characters to escape. This caused append_if_no_line to possibly add
lines with a dollar sign in them many times even after they have been
added.
  • Loading branch information
rtkmparrott committed Mar 4, 2014
1 parent 407853d commit 9748835
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
#

def escape_string(string)
pattern = /(\+|\'|\"|\.|\*|\/|\-|\\|\(|\)|\{|\})/
pattern = /(\+|\'|\"|\.|\*|\/|\-|\\|\(|\)|\{|\}|\^|\$)/
string.gsub(pattern){|match|"\\" + match}
end

0 comments on commit 9748835

Please sign in to comment.