[BUG] js quickadd String replace
, test
function and other manipulations assumes literal {{VALUE}}
, not selection
#672
Labels
bug
Something isn't working
Describe the bug
Using
js quickadd
in the Capture Fromat:where
val = “{{VALUE}}”
,val.replace
function assumes literal{{VALUE}}
, not selection, if grep matches something in the literal string”{{VALUE}}”
, otherwise leaves selection.If you simply
return val
, it returns the selection.To Reproduce
will incorrectly return
{{9ALUE}}
as theV
matches in{{VALUE}}
.{{VALUE}}
seemingly doesn’t get replaced with the selected text, but is taken literally.Whereas, omitting the
V
in the grep pattern:This will do nothing, and correctly return the selected text (not
{{VALUE}}
), because/[WXYZwxyz]/g
doesn’t match anything in the string{{VALUE}}
.Expected behavior
replace should use the replacement selection string. In the example above, depending on the selection.
If selection =
VWA
, then replaced with99A
, not{{9ALUE}}
Desktop (please complete the following information):
Additional context
I’m trying to implement a “Convert Phone to Link” function:
This will always return
[ACTUAL PHONE NUMBER SELECTED](tel:82583)
because 82582 is VALUE on the numeric keypad.The text was updated successfully, but these errors were encountered: