Regex/QA Checker 3.0 > If (word1) and (word2) are both in the sentance
Thread poster: Lenart
Lenart  Identity Verified
Luxembourg
Local time: 19:53
Jun 14

I would like QA checker to show an error every time apples and bananas are in the same segment.

I thought this code in Regex target should do the work: (?=apples)(?=bananas)

but it doesn't

can somebody please explain me where is the error or propose a different code for the same goal?

also, is there some sort of list of regex expressions for QA checker?

thank you,

L


Direct link Reply with quote
 

Eirik Birkeland  Identity Verified
Norway
Local time: 19:53
Member (Jun 2017)
English to Norwegian (Bokmal)
+ ...
Lookaheads, etc. Jun 14

(?=apples) is an example of a lookahead. This type of pattern is useful in some cases, but is often not essential.

I suggest trying the following:

apples.*bananas|bananas.*apples

This will match
apples, followed by anything, followed by bananas
OR
bananas, following by anything, followed by apples

It's not a very elegant expression, but you can check a demo here:
https://regex101.com/r/kqBCzb/1

It seems to me that the program you are using supports standard PCRE (Perl-compliant regular expressions), and if that is actually the case I highly recommend http://www.regular-expressions.info/ as a concise and powerful resource for regular expressions.


Direct link Reply with quote
 
Lenart  Identity Verified
Luxembourg
Local time: 19:53
TOPIC STARTER
Thank you Erik, Jun 15

that was very helpful!

Direct link Reply with quote
 
Lenart  Identity Verified
Luxembourg
Local time: 19:53
TOPIC STARTER
if source start with («) and target start with anything different then („) Jun 15

if you can help me out with one more, I would appreciate it

if source start with («) and target starts with anything different then („), send me an error.

So i would need

a code for Regex Source: if segment starts with («)

and

a code for Regex Target: if segment starts with anything else then („)


Direct link Reply with quote
 

Riccardo Schiaffino  Identity Verified
United States
Local time: 11:53
Member (2003)
English to Italian
+ ...
The regex flavor used by Studio is .NET Jun 15

Eirik Birkeland wrote:

It seems to me that the program you are using supports standard PCRE (Perl-compliant regular expressions), and if that is actually the case I highly recommend http://www.regular-expressions.info/ as a concise and powerful resource for regular expressions.


Actually, I believe that the regex flavor used by Studio is .NET. A useful free tool to build and check .NET regular expressions is Expresso

An expression you can use could be

(apple|banana).*(banana|apple)


Direct link Reply with quote
 

Riccardo Schiaffino  Identity Verified
United States
Local time: 11:53
Member (2003)
English to Italian
+ ...
Regex for quotes at the start Jun 15

Lenart wrote:

if you can help me out with one more, I would appreciate it

if source start with («) and target starts with anything different then („), send me an error.

So i would need

a code for Regex Source: if segment starts with («)

and

a code for Regex Target: if segment starts with anything else then („)


regex for source:


regex for target:
^[^„]

In fact for the source you can also make it more universal, e.g.:

^[«"“]

This would cover any segment that starts with a French, straight or curly double quotes


Direct link Reply with quote
 

Riccardo Schiaffino  Identity Verified
United States
Local time: 11:53
Member (2003)
English to Italian
+ ...
For more on the use of regex in CAT tools Jun 15

For more on the use of regular expressions in CAT tools, please see http://www.aboutranslation.com/p/regular-expressions.html



[Edited at 2017-06-15 17:52 GMT]


Direct link Reply with quote
 
Lenart  Identity Verified
Luxembourg
Local time: 19:53
TOPIC STARTER
thank you Jun 16

for codes and bunch of very useful information

Direct link Reply with quote
 
Lenart  Identity Verified
Luxembourg
Local time: 19:53
TOPIC STARTER
count of an specific word in source and target Jun 20

I have another related question end would appreciate any help.

Here's the issue: Word "apple" appears 3 times in source sentence. It corresponds to a word "pomme" which also appears 3 times in target.

I would like to check if number of repetition of the word apple is the same as number of repetition of word pomme.

in Verification/qa checker 3.0/Regular expressions I insert this:

Regex source:apple
Regex target:pomme

and I choose the condition: Report if warning source and target match but with different count

I run the check and don't get any warnings as I have 3 times apple in source and 3 times pommes in target

However, if I use the same condition and change regex target slightly (Regex target:pomm.*ver.*), I get an warning that a segment includes 3 times apple, but only one time pomm.*ver.* (even though the word pomme vert actually repeats 3 times in target).

Does anybody have an explanation why? It seems as though regex stops counting once it finds a word witch ends with.*
Is there any way to avoid this?

or is there any other way to check if number of repetition of the word apple is the same as number of repetition of word „pomm.*ver.*“?

Thank you

[Edited at 2017-06-20 13:29 GMT]

[Edited at 2017-06-20 13:38 GMT]

[Edited at 2017-06-20 13:46 GMT]

[Edited at 2017-06-21 07:02 GMT]


Direct link Reply with quote
 


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


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

Regex/QA Checker 3.0 > If (word1) and (word2) are both in the sentance

Advanced search







BaccS – Business Accounting Software
Modern desktop project management for freelance translators

BaccS makes it easy for translators to manage their projects, schedule tasks, create invoices, and view highly customizable reports. User-friendly, ProZ.com integration, community-driven development – a few reasons BaccS is trusted by translators!

More info »
Wordfast Pro
Translation Memory Software for Any Platform

Exclusive discount for ProZ.com users! Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value

More info »



Forums
  • All of ProZ.com
  • Term search
  • Jobs
  • Forums
  • Multiple search