Why does this regex match?

I am a bit puzzled by a regex match:

Trados Studio screenshot showing a warning message 'Error 1.2: Wrong type of dash in numeric range; target matches count: 1.' in the Messages panel, with a translation segment ' 754 - 81cm Poster' highlighted above.

In the above screenshot, the regex matches if I have a no-break space between "81" and "cm". I does not match if I replace the no-break space with a normal space.

This is the regex:

[\d,]*\d((\s?[\x2D\u058A\u1806\u2012\u2014\u2015\uFE63\uFF0D]\s?)|(\s\u2012\s)|(\s\u2012)|(\u2012\s))+\d[\d,]*

As the name suggests, I want it to match when a date range or numerical range is connected with a dash other than an en-dash.

Why does it match here? What did I do wrong?

Daniel



Generated Image Alt-Text
[edited by: Trados AI at 4:32 AM (GMT 0) on 5 Mar 2024]
emoji
Parents
  • On a quick inspection I'd say it's because the criteria for numbers matches but without the dashes, you have spaces instead.  But t's a bit of a guess because using this alone may not be representative of what you have in the sdlxliff or what Studio may be doing (it's always possible Studio is simply wrong and it's not your rule at all):

    F754 8 cm Pfoster

    If you can share the file, at least with that segment in it, I'm happy to take a look?

    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

Reply
  • On a quick inspection I'd say it's because the criteria for numbers matches but without the dashes, you have spaces instead.  But t's a bit of a guess because using this alone may not be representative of what you have in the sdlxliff or what Studio may be doing (it's always possible Studio is simply wrong and it's not your rule at all):

    F754 8 cm Pfoster

    If you can share the file, at least with that segment in it, I'm happy to take a look?

    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

Children