diff options
| author | Benjamin Linskey | 2026-06-07 12:51:13 -0400 |
|---|---|---|
| committer | Benjamin Linskey | 2026-06-07 19:50:56 -0400 |
| commit | 1cedfb65dc3a2a6428e7492ed61c2060a9844810 (patch) | |
| tree | f02a67a3841d067b9c722c0f98979dcb8847ca2f | |
| parent | 2aa8ed870cb212328563b8a300b3a3b6754ce4e6 (diff) | |
| download | tpl-1cedfb65dc3a2a6428e7492ed61c2060a9844810.tar.gz | |
Add a note about regex metacharacter escaping
| -rwxr-xr-x | tpl | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -32,6 +32,11 @@ FILENAME == ARGV[1] && NF == 2 { match(matched_text, /[^\{\}[:space:]]+/) var_name = substr(matched_text, RSTART, RLENGTH) + # Even though matched_text contains the { and } regex + # metacharacters, we don't need to escape them because they're + # not used in a way that matches the (r){m,n} syntax. + # (We don't need to escape them elsewhere in this program + # either, but we do so for maximum clarity.) sub(matched_text, vals[var_name], $2) } |