-
Notifications
You must be signed in to change notification settings - Fork 7.6k
REVIEW ONLY: Fix regexp replace in Replace All #5772
Conversation
When there are only 3 params left, we should call the function with only 3 params, too. |
Everything looks good to me. I did a bunch of testing with 'Replace All', and everything worked as expected. |
@njx Fix looks good to me too. It doesn't look like there's any way it could affect the existing non-regexp Replace All functionality. OTOH I think it'd also be ok to just change the release notes to say $n substitution is only supported for regular Replace. |
@SAplayer - not sure what you mean. I removed the old replace function from the call to |
Btw -- not related to this bug, but... if the user wanted the literal string "$1" to be the replacement when doing a regexp Replace, is there any escaping that would allow that? It looks like you'd normally be able to use "$$" to escape "$," but we don't appear to support that. |
@njx I mean, when this function is called, we should only pass 3 params instead of 4. |
@SAplayer Can you comment on the specific line you're referring to? The only call to that function is 3 params: |
@peterflynn Good point, should file that separately. |
@njx Oh, sorry, I've missed that. Everything's ok ;) |
REVIEW ONLY: Fix regexp replace in Replace All
@peterflynn - @SAplayer added code to handle $$; if you have a chance, feel free to try it and see if you find any issues. |
For #5770.
When doing a replace all, the replace function used by regexp replace needs to use the matches from each item in the
replace all, not the match that was found in the calling
replace()
.