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: 08:01
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: 02:01
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: 08:01
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: 09:01
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: 08:01
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)






Protemos translation business management system
Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!

The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.

More info »
TM-Town
Manage your TMs and Terms ... and boost your translation business

Are you ready for something fresh in the industry? TM-Town is a unique new site for you -- the freelance translator -- to store, manage and share translation memories (TMs) and glossaries...and potentially meet new clients on the basis of your prior work.

More info »