Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
TekWizely committed Oct 13, 2024
1 parent b5836c1 commit 393ed49
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
26 changes: 13 additions & 13 deletions bash-tpl
Original file line number Diff line number Diff line change
Expand Up @@ -424,19 +424,19 @@ function escape_regex() {
local e="${!1}"
# Escape '\' first since we'll be adding more after
e="${e//\\/\\\\}"
e="${e//'$'/'\$'}"
e="${e//'*'/'\*'}"
e="${e//'+'/'\+'}"
e="${e//'.'/'\.'}"
e="${e//'?'/'\?'}"
e="${e//'^'/'\^'}"
e="${e//'|'/'\|'}"
e="${e//'('/'\('}"
e="${e//')'/'\)'}"
e="${e//'['/'\['}"
e="${e//']'/'\]'}"
e="${e//'{'/'\{'}"
e="${e//'}'/'\}'}"
e="${e//'$'/\\$}"
e="${e//'*'/\\*}"
e="${e//'+'/\\+}"
e="${e//'.'/\\.}"
e="${e//'?'/\\?}"
e="${e//'^'/\\^}"
e="${e//'|'/\\|}"
e="${e//'('/\\(}"
e="${e//')'/\\)}"
e="${e//'['/\\[}"
e="${e//']'/\\]}"
e="${e//'{'/\\{}"
e="${e//'}'/\}}"
printf -v "${1}" "%s" "${e}"
}

Expand Down
3 changes: 3 additions & 0 deletions test/template-regexes.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1395,9 +1395,12 @@ setup() {
[[ '<%$%>' =~ $TAG_STATEMENT_REGEX ]]
[[ '<%$ %>' =~ $TAG_STATEMENT_REGEX ]]
[[ '<%$ %>' =~ $TAG_STATEMENT_REGEX ]]
# shellcheck disable=SC2016
[[ '<%$tag%>' =~ $TAG_STATEMENT_REGEX ]]
[[ '<%$ tag%>' =~ $TAG_STATEMENT_REGEX ]]
# shellcheck disable=SC2016
[[ '<%$tag %>' =~ $TAG_STATEMENT_REGEX ]]
# shellcheck disable=SC2016
[[ '<%$ $tag %>' =~ $TAG_STATEMENT_REGEX ]]
[[ '<%$$ $%>' =~ $TAG_STATEMENT_REGEX ]]
[[ '<%$$ $ %>' =~ $TAG_STATEMENT_REGEX ]]
Expand Down

0 comments on commit 393ed49

Please sign in to comment.