You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
replace plugin. "delimiters" config is broken by "escape" internal mutation #904
The delimiters option that is matching the default value should work the same
Actual Behavior
Unfortunately, the escape internal function that is supposed to escape RegExp string malfunctions.
So it's impossible to reproduce the current default behavior because of that.
As you said, it's impossible to provide any special RegExp character (such as \b) because of this escape function.
// Current escape functionfunctionescape(str){returnstr.replace(/[-[\]/{}()*+?.\\^$|]/g,'\\$&');}newRegExp(escape('\\b'))// Result: /\\b/newRegExp(escape('\b'))// Result: /�/// How do we get /\b/ ?
Perhaps an option should be added that allows bypassing this function when creating the pattern?
Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ⓘ
Btw, just to provide clarity why I didn't provide a PR for this issue.
The default behavior in #903 resolved the need for me to pass custom delimiters.
Activity
vegeta897 commentedon Jul 31, 2021
Any update on this?
As you said, it's impossible to provide any special RegExp character (such as
\b) because of this escape function.Perhaps an option should be added that allows bypassing this function when creating the pattern?
stale commentedon Oct 1, 2021
Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ⓘ
ef4 commentedon Oct 28, 2021
This is definitely a real bug. The delimiter option really should not run through
escape.shellscape commentedon Oct 29, 2021
@ef4 please read the bot's message. If you'd like to open a PR for this, we'd be happy to reopen.
o-alexandrov commentedon Oct 29, 2021
Btw, just to provide clarity why I didn't provide a PR for this issue.
The default behavior in #903 resolved the need for me to pass custom delimiters.
shellscape commentedon Oct 29, 2021
Appreciate the clarity. If someone picks this up, we'll reopen. Thanks again for the work on #903