Replace-all Fails for RexExP Replacements

15 views
Skip to first unread message

tbp1...@gmail.com

unread,
Nov 21, 2020, 7:46:56 AM11/21/20
to leo-editor
When I run a search/replace with a RegExp search phrase, and I want to specify a group to change, the replace works when I use the command replace-then-find (ALT+-), but it fails when I run replace-all.

Test case: Add a space following a regex group -

1. Enter the following into a node body:
2000.01word1
1847.00word2


2. Set up the FIND panel for node-only, body-only, RegeXp.
3. Enter the search phrase: (\.\d\d)
4. Enter the replacement phrase: \1
    (that is "\1" followed by a space).
5. Press <ALT><-> (ALT MINUS) twice.

Expected result:
2000.01 word1
1847.00 word2
Observe that we got the expected result.

6. Restore original text, say with <CNTRL-z>.
7. Run the replace-all command (<ALT-X>replace-all<ENTER><TAB><TAB>).

Expected result: Same as above.
Leo result:
2000\1 word1
1847\1 word2


It looks like Leo doesn't honor the regex-ness of the replacement phrase, but only for replace-all.

Edward K. Ream

unread,
Nov 21, 2020, 9:58:14 AM11/21/20
to leo-editor
On Sat, Nov 21, 2020 at 6:46 AM tbp1...@gmail.com <tbp1...@gmail.com> wrote:

It looks like [replace-all] doesn't honor [the regex option].

Thanks for the report. I have just created #1748 for this. It will get fixed soon.

Edward
Reply all
Reply to author
Forward
0 new messages