How to search for segment that does NOT contain something (online project)
Thread poster: Neil Allen
Neil Allen
Neil Allen  Identity Verified
France
Local time: 11:56
Member
French to English
Dec 6, 2022

I would like to know the correct procedure for filtering on a negative case, meaning something that is NOT there.

For example, imagine I have a particular word that should have a full stop after it, but there are many instances where this full stop is missing.

In a local project, I would filter for the word with the full stop and lock all the segments.

Then I would filter on all unlocked segments looking for just the word.

This would show me al
... See more
I would like to know the correct procedure for filtering on a negative case, meaning something that is NOT there.

For example, imagine I have a particular word that should have a full stop after it, but there are many instances where this full stop is missing.

In a local project, I would filter for the word with the full stop and lock all the segments.

Then I would filter on all unlocked segments looking for just the word.

This would show me all the segments that do not have the full stop after it.

The above works perfectly, but what can be done in online projects where it is not possible to lock segments? I could change the status to "edited", "not started" or "pretranslated" but this would mess up the entire project.

Does anyone have any suggestions concerning how to perform such a "negative search" in an online project?
Collapse


 
William Tierney
William Tierney  Identity Verified
United States
Local time: 05:56
Member (2002)
Arabic to English
REGEX to the rescue Dec 6, 2022

Hi Neil,

This sounds like a job for regular expressions (REGEX). I have used it for various filters in both the target and source columns. MemoQ has a series of tutorials, and there are other tutorials out there. It takes a bit for a "word person" to get their head rapped around the symbolic logic aspects of REGEX, but it is a powerful tool.


Daniel Fernandes
 
Neil Allen
Neil Allen  Identity Verified
France
Local time: 11:56
Member
French to English
TOPIC STARTER
There probably is a solution with REGEX Dec 6, 2022

Hi William,

I think you are right, but the difficulty lies in searching for what is NOT there, rather than what IS there.

It appears it can be done with a negative lookahead.

Thanks for your reply!


 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 12:56
English to Russian
Regular expressions Dec 6, 2022

Try this regular expression that will filter all segments that do not contain 'word.' (your case):
^(?>(?!word\.).)*$
For this regex you also need to type the source term for memoQ to narrow down the scope of filtering:
Source filter: (?i)mot
Target filter: ^(?>(?!word\.).)*$

(?i) means non case sensitive, i.e. it includes mot and Mot.

If you suppose that your target segments may contain the 'word(.)' but not the source equiva
... See more
Try this regular expression that will filter all segments that do not contain 'word.' (your case):
^(?>(?!word\.).)*$
For this regex you also need to type the source term for memoQ to narrow down the scope of filtering:
Source filter: (?i)mot
Target filter: ^(?>(?!word\.).)*$

(?i) means non case sensitive, i.e. it includes mot and Mot.

If you suppose that your target segments may contain the 'word(.)' but not the source equivalent 'mot(.)', then you can use this for the target filter:
(?i)word[^\.]|(?i)word$

===
Another regex that may be useful too filters segments that include word1 but do not include word2 (not your case but just in case):
^(?!.*(\bword2\b)).*(\bword1\b).*

[Edited at 2022-12-06 20:42 GMT]
Collapse


 
Neil Allen
Neil Allen  Identity Verified
France
Local time: 11:56
Member
French to English
TOPIC STARTER
Another solution Dec 6, 2022

Thanks, Stepan.

In case this comes up again, it can also be done with a negative lookahead.

investment(?!\.)

will find all instances of the word "investment" without a following full stop.

Many thanks for your input.

[Edited at 2022-12-06 21:18 GMT]


Stepan Konev
 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

How to search for segment that does NOT contain something (online project)






CafeTran Espresso
You've never met a CAT tool this clever!

Translate faster & easier, using a sophisticated CAT tool built by a translator / developer. Accept jobs from clients who use Trados, MemoQ, Wordfast & major CAT tools. Download and start using CafeTran Espresso -- for free

Buy now! »
Trados Business Manager Lite
Create customer quotes and invoices from within Trados Studio

Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.

More info »