Regex to identify mismatch between source and target segment in sdlxliff?

Hello,

just now I was struck with an error that happened while splitting/merging segments in a not too small sdlxliff (from an idml file). First of all: Good documentation in the SDL Knowledge base! (https://gateway.rws.com/csm?id=kb_article_view&sysparm_article=KB0033114)

The problem was a mismatch between source and target segment.

Marking the relevant bits I scrolled through the file with Notepad++, found the offending segment and also found that once you apply Pretty Print to the sdlxliff file Strudio won't accept it anymore, so back to the backup file, fix the mismatch (once you know the numbers you don't need Pretty Print anymore), all fine, file works nicely now.

Phew.

Here's my question: Does anyone have a Regex that finds this kind of mismatch between source and target segment? It does take quite some time to find the broken part of the file...

Or is it too much for Regex and one would be better off with a proper parser?

Screenshot of Trados Studio error message indicating a mismatch between source and target segments in an sdlxliff file.

Daniel



Generated Image Alt-Text
[edited by: Trados AI at 4:07 AM (GMT 0) on 5 Mar 2024]
emoji
Parents Reply
  • Hi Paul,

    it was always just one file that never got split or merged. I had to split and merge a lot of segments though, that is when it happened. I sometimes had to merge split segments across what had formerly been a segment.

    To fix it, I just followed the step "Resolution" in the KB article linked to above (). I think I just deleted the segments 379 and 380 in the target (see screenshot abouve) and everything was fine again.

    The main task was finding out where the mismatch was. Fixing it was easy. (Hence my question about a regex...)

    Daniel

Children
  • Hi

    I think, that if the source equalled target then this could be possible with regex. But if the target has been translated, or changed in some way then I think regex may not be a good solution for this as you never know how many mrk elements there are and you'd need to be able to ignore the differences in translatable text.

    Maybe someone smarter than me with regex could find a way to do it, but I think it would require a small application built to find these issues.

    Paul Filkin | RWS

    Design your own training!
    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub