RegEx to identify unpaired parentheses (open but not closed) in target during QA

Hi everyone!

I don't know if it's possible to do what I want during QA. I'm trying to find unpaired parentheses, but only in the target.

Example: The sly fox (paragraph 5.3 went after the slow hare.

I did a couple of searches to test regex strings that I came up with, but ended up with too many false positives. These showed up, for example, every time that the source had parentheses and the target didn't.

I also tried using “check brackets” under punctuation in the QA Checker (so it wouldn't need regex). But that also gave the same false positives (the source had parentheses and the target didn't), as well as false positives when I had added parentheses of my own in the target.

Thanks in advance for your help!

best,

Becky

(I'm using Trados Studio 2022)

emoji
Parents
  •  

    After a year of this post, I’m back with it! Grinning

    The following regex works for both missing opening and closing brackets (it matches nested brackets, but they are rare avis and maybe wrong after all, so I’d check them):

    ^[^\(]*\)|\([^\)]*\(|\)[^\(]*\)|\([^\)]*$

    PS.: Borrowed from https://forum.xbench.net/t/need-more-unpaired-parenthesis-checks/106/5

    The logic behind is so easy that it’s possible to split the above regex in 4 separate rules easier to read while QA’ing:

    • ^[^\(]*\) to match an unpaired closing bracket at the beginning of the segment
    • \([^\)]*\( to match 2 consecutive opening brackets
    • \)[^\(]*\) to match 2 consecutive closing brackets
    • \([^\)]*$ to match an unpaired opening bracket at the end of the segment

    Tested with the following text here https://regex101.com/:

    RIGHT BRACKETS =========
    aa (bbbb)
    aa (bbbb) aa (bbbb)
    aa (bbbb) aa (bbbb) aa (bbbb)
    aa (bb (nested brackets))

    WRONG BRACKETS ==========
    aa bbbb)
    aa bbbb) aa (bbbb)
    aa (bbbb) aa bbbb)
    aa bbbb) aa (bbbb) aa (bbbb)
    aa (bbbb) aa bbbb) aa (bbbb)
    aa (bbbb) aa (bbbb) aa bbbb)

    aa (bbbb
    aa (bbbb aa (bbbb)
    aa (bbbb) aa (bbbb
    aa (bbbb aa (bbbb) aa (bbbb)
    aa (bbbb) aa (bbbb aa (bbbb)
    aa (bbbb) aa (bbbb) aa (bbbb

    emoji
Reply
  •  

    After a year of this post, I’m back with it! Grinning

    The following regex works for both missing opening and closing brackets (it matches nested brackets, but they are rare avis and maybe wrong after all, so I’d check them):

    ^[^\(]*\)|\([^\)]*\(|\)[^\(]*\)|\([^\)]*$

    PS.: Borrowed from https://forum.xbench.net/t/need-more-unpaired-parenthesis-checks/106/5

    The logic behind is so easy that it’s possible to split the above regex in 4 separate rules easier to read while QA’ing:

    • ^[^\(]*\) to match an unpaired closing bracket at the beginning of the segment
    • \([^\)]*\( to match 2 consecutive opening brackets
    • \)[^\(]*\) to match 2 consecutive closing brackets
    • \([^\)]*$ to match an unpaired opening bracket at the end of the segment

    Tested with the following text here https://regex101.com/:

    RIGHT BRACKETS =========
    aa (bbbb)
    aa (bbbb) aa (bbbb)
    aa (bbbb) aa (bbbb) aa (bbbb)
    aa (bb (nested brackets))

    WRONG BRACKETS ==========
    aa bbbb)
    aa bbbb) aa (bbbb)
    aa (bbbb) aa bbbb)
    aa bbbb) aa (bbbb) aa (bbbb)
    aa (bbbb) aa bbbb) aa (bbbb)
    aa (bbbb) aa (bbbb) aa bbbb)

    aa (bbbb
    aa (bbbb aa (bbbb)
    aa (bbbb) aa (bbbb
    aa (bbbb aa (bbbb) aa (bbbb)
    aa (bbbb) aa (bbbb aa (bbbb)
    aa (bbbb) aa (bbbb) aa (bbbb

    emoji
Children
No Data