Skip to content

Commit

Permalink
Fix a regex escaping issue
Browse files Browse the repository at this point in the history
An additional `\` character is needed to prevent escape characters from
being stripped within nested parentheses
  • Loading branch information
molovo committed Jul 26, 2017
1 parent 99e82df commit 2d18ad6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tipz.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function _tipz_find_match() {
# Create a regex that finds an exact match for
# the current argument string
args="${(@)args[@]}"
local pattern=$'^[\'\"]?'${args//([\{\}\(\)\[\]\*\?\:\\\.\|])/\\$1}$'[\'\"]?$'
local pattern=$'^[\'\"]?'${args//([\{\}\(\)\[\]\*\?\:\\\.\|])/\\\$1}$'[\'\"]?$'

# Check if the command matches the regex
if [[ "$command" =~ $pattern ]]; then
Expand Down

0 comments on commit 2d18ad6

Please sign in to comment.