diff options
-rwxr-xr-x | upd8.js | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/upd8.js b/upd8.js index 17811076..d2983e7e 100755 --- a/upd8.js +++ b/upd8.js @@ -970,13 +970,30 @@ const replacerSpec = { const tagArgumentValue = '='; const tagLabel = '|'; - const R_tagBeginning = escapeRegex(tagBeginning); - const R_tagEnding = escapeRegex(tagEnding); - const R_tagReplacerValue = escapeRegex(tagReplacerValue); - const R_tagHash = escapeRegex(tagHash); - const R_tagArgument = escapeRegex(tagArgument); - const R_tagArgumentValue = escapeRegex(tagArgumentValue); - const R_tagLabel = escapeRegex(tagLabel); + const noPrecedingWhitespace = '(?<!\\s)'; + + const R_tagBeginning = + escapeRegex(tagBeginning); + + const R_tagEnding = + escapeRegex(tagEnding); + + const R_tagReplacerValue = + noPrecedingWhitespace + + escapeRegex(tagReplacerValue); + + const R_tagHash = + noPrecedingWhitespace + + escapeRegex(tagHash); + + const R_tagArgument = + escapeRegex(tagArgument); + + const R_tagArgumentValue = + escapeRegex(tagArgumentValue); + + const R_tagLabel = + escapeRegex(tagLabel); const regexpCache = {}; |