Menu

#1330 Regex capturing groups fail when "Space matches nbsp" option is on

None
open
nobody
None
6.0.1
5
2026-08-12
2026-08-12
No

Version: OmegaT-6.0.1_0_42ef0143
Platform: Linux 6.18.44-1-MANJARO
Java: 17.0.14 amd64
Memory: 824MiB total / 575MiB free / 1024MiB max

Description

When using the "Replace" function with regex capture groups, the result is incorrect if the "Space matches nbsp" option is checked. The capture groups appear to be shifted or corrupted during the replacement process.

Steps to Reproduce

  1. In a project, have a translation segment containing: a b c
  2. Open Edit -> Replace...
  3. Check the option "Space matches nbsp"
  4. Set Search for: (a) (b) (c)
  5. Set Replace with: $1-$2-$3
  6. Click Replace (or Replace All)

Expected Result

The string a b c is replaced with a-b-c.

Actual Result

The string a b c is replaced with a- -b.

Workaround

Unchecking the "Space matches nbsp" option allows the regex to function as expected.

Additional Notes

This issue appears related to, or a regression of, fixed ticket: https://sourceforge.net/p/omegat/bugs/951/

Discussion


Log in to post a comment.