Menu

#907 Empty regex capture group becomes "null" in replacement

4.1
closed-fixed
None
5
2018-06-08
2018-04-13
No

The addition of Regular Expressions capture in 4.1.4 is a big help but there seems to be a little issue with the implementation of capture groups: when a capture group is empty it will return "null" (in plain text) instead of nothing so if I try to capture series of numbers like so

Test text:
22.5.5.2
22.5.6
23
23.1

using the following expression:
^(\d+)(.\d+)?(.\d+)?(.\d+)?$

and I replace it with:
$1$2$3$4

I will get:
22.5.5.2
22.5.6null
23nullnullnull
23.1nullnull

When I would expect to get the test text back without any modification.

Discussion

  • Damien Rembert

    Damien Rembert - 2018-04-13

    This is to do with the recently implemented feature request:[#953]

     

    Related

    Bugs: #953

  • Aaron Madlon-Kay

    • summary: Empty regex capture group returns NULL in plain text --> Empty regex capture group becomes "null" in replacement
    • status: open --> open-fixed
    • assigned_to: Aaron Madlon-Kay
     
  • Aaron Madlon-Kay

    Fixed in trunk, [r10347]. Null groups are replaced as the empty string, which is the same behavior as e.g. jEdit.

     

    Related

    Commit: [r10347]


    Last edit: Aaron Madlon-Kay 2018-04-20
  • Didier Briel

    Didier Briel - 2018-06-08
    • status: open-fixed --> closed-fixed
     
  • Didier Briel

    Didier Briel - 2018-06-08

    Closed in the released version 4.1.5 of OmegaT.

    Didier

     

Log in to post a comment.