QA Checker 3.0 > Word list
Thread poster: Lenart
Lenart
Lenart  Identity Verified
Luxembourg
Local time: 19:47
Aug 28, 2019

Hello,

I am searching for a way to include this word rule for target:

show me an error if this character [ in not at some point of the paragraph followed by this character ]

My try was this \[.*[^\]]

unfortunately it does not work.

any ideas how to achieve that?


 
Anthony Rudd
Anthony Rudd

Local time: 19:47
German to English
+ ...
Search for missing following character Aug 29, 2019

Try
(?=\[)(?!.*\])


 
Lenart
Lenart  Identity Verified
Luxembourg
Local time: 19:47
TOPIC STARTER
Anthony thank you!! Aug 29, 2019

I symply tried negative lookahead [(?!.*\]) and it seems to be working.

however (?=\[)(?!.*\]) is not working.

Could you explain what is the logic behind (?=\[)

thank you!!


 
Anthony Rudd
Anthony Rudd

Local time: 19:47
German to English
+ ...
Be careful when searching for negatives Aug 29, 2019

Consider what \[.*[^\]] means -> basically find something that is not a close square bracket, which will almost always be true.

(?=\[) -> positive lookahead to find an open square bracket.
(?!.*\])-> negative lookahead to find (the absence of) a close square bracket.


 
Lenart
Lenart  Identity Verified
Luxembourg
Local time: 19:47
TOPIC STARTER
I wander what is a difference between (?=\[) and simple [ Aug 29, 2019

(?=\[) -> positive lookahead to find an open square bracket.


but if I just write [ regex will find an open square bracket.


I wander what is a difference between (?=\[) and simple [


 
Anthony Rudd
Anthony Rudd

Local time: 19:47
German to English
+ ...
Explanation Aug 29, 2019

The lookahead (?=\[) basically searches for the presence of a [
The simple [ matches the presence of a [

In this case you could also write [(?!.*\])
which at least in Studio Find/Replace flags a missing close square bracket.
I often use such regexes to do a quick QA that I invoke from Find/Replace to find inconsistencies


 
Lenart
Lenart  Identity Verified
Luxembourg
Local time: 19:47
TOPIC STARTER
hmmmmm so (?=\[) and [ are the same thing, no? Aug 29, 2019

Anthony Rudd wrote:

The lookahead (?=\[) basically searches for the presence of a [
The simple [ matches the presence of a [



hmmmmm so (?=\[) and [ are the same thing, no?

I don't see any difference between them


 
Anthony Rudd
Anthony Rudd

Local time: 19:47
German to English
+ ...
Difference Aug 29, 2019

The key difference is "search for" and "match".
In this particular case, either can be used, but the "negative lookahead" is required to "search for" the missing ]


 
Lenart
Lenart  Identity Verified
Luxembourg
Local time: 19:47
TOPIC STARTER
QA Checker 3.0 > Word list Sep 6, 2019

Hello,

I have one more question with this text: C-529/07, EU:T:2009:361

I want to make a rule> notify error if there is: "C-" followed by 3 to 7 characters of any kind flowed by EU:T

my try, that doesn't work, was this: C.*{1,2,3,4,5,6,7,8,9}EU:T:

anybody knows where is the problem?


 
Anthony Rudd
Anthony Rudd

Local time: 19:47
German to English
+ ...
regex expression Sep 7, 2019

C-.{3,7}EU:T

 
Lenart
Lenart  Identity Verified
Luxembourg
Local time: 19:47
TOPIC STARTER
thank you Anthony!! Sep 7, 2019

this non-gready code works fine too

C-.*?EU:T:


 
Anthony Rudd
Anthony Rudd

Local time: 19:47
German to English
+ ...
regex Sep 7, 2019

But you wanted 3 to 7 characters.

 
Lenart
Lenart  Identity Verified
Luxembourg
Local time: 19:47
TOPIC STARTER
another qustion Oct 2, 2019

I have this situation:

Source:(space)NJ(space)

RegEx source: (?>!\w)NJ(?!\w)

when I run Regex, nothing is found. Anthony or anybody else, would you be so kind and explain why?

to my knowledge \w does not include space, so I would expect this regex to find the source


 
Anthony Rudd
Anthony Rudd

Local time: 19:47
German to English
+ ...
Regex Oct 3, 2019

(?!\w)NJ(?!\w)

I would suggest you use a regex test tool, such as RegexHero (licence-free), that provides analysis capability. Such a tool often finds basic errors.


Lenart
 
Lenart
Lenart  Identity Verified
Luxembourg
Local time: 19:47
TOPIC STARTER
thank you Anthony! Oct 3, 2019

thank you, yes lookbehind was wrong

[Edited at 2019-10-03 09:31 GMT]


 


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


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

QA Checker 3.0 > Word list







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 »