Studio: How to prevent segment filter from parsing search term as regular expression?
Thread poster: Erik Freitag

Erik Freitag  Identity Verified
Germany
Local time: 01:06
Member (2006)
Dutch to German
+ ...
Sep 18, 2011

Dear colleagues,

In Studio 2009, I was trying to filter the target segments that contain the string "i.e.". However, the filter function seems to interpret the search string as a regular expression, which I don't want here.

As I'm not very familiar with regex, I'd appreciate your help:

1. How can I prevent the segment filter from parsing the search term as a regex?
2. If that's not possible: What would a regex to find all segments containing the string "i.e." or "i. e." look like?

Many thanks in advance,
kind regards,
Erik



[Bearbeitet am 2011-09-18 11:20 GMT]


Direct link Reply with quote
 

Jerzy Czopik  Identity Verified
Germany
Local time: 01:06
Member (2003)
Polish to German
+ ...
Dot is an element of regex Sep 18, 2011

So you have to "escape" the dot, if you want to look for a dot and not for character category, represented by the dot.
It is quite easy to remember: if something does not bring the result you expect, try to "escape" it.

The regex for "i. e." is "i\. e\."
The \ character means "escape", that is the character which follows after \ will be searched as is and not with its regex meaning (at least in the easiest explanation, it is in fact not that easy).


Direct link Reply with quote
 

Erik Freitag  Identity Verified
Germany
Local time: 01:06
Member (2006)
Dutch to German
+ ...
TOPIC STARTER
Thanks Sep 18, 2011

Dear Jerzy,

Many thanks for your explanation. Allow me one further question: Is there a simple way of defining a whole string as non-regex, then?

Kind regards,
Erik


Direct link Reply with quote
 

Jerzy Czopik  Identity Verified
Germany
Local time: 01:06
Member (2003)
Polish to German
+ ...
Maybe... Sep 18, 2011

maybe it is possible, but I really do not know

Direct link Reply with quote
 

Erik Freitag  Identity Verified
Germany
Local time: 01:06
Member (2006)
Dutch to German
+ ...
TOPIC STARTER
Thanks! Sep 18, 2011

Thanks, Jerzy! Your hint has helped me a lot!

Kind regards,
Erik


Direct link Reply with quote
 
FarkasAndras
Local time: 01:06
English to Hungarian
+ ...
No Sep 19, 2011

efreitag wrote:

Is there a simple way of defining a whole string as non-regex, then?


Apparently, no. Normally, it would be \Q...\E, which forces the regex engine to read everything between \Q and \E literally. However, this is not supported by the .NET regex engine, which Stuio uses. Apparently, .NET doesn't have any such feature so you have to escape (meta)characters one by one with \.
In the Find and Replace box, you can just disable regular expressions altogether, but in the Filter box, you can't.


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 »

Studio: How to prevent segment filter from parsing search term as regular expression?

Advanced search







SDL Trados Studio 2017 Freelance
The leading translation software used by over 250,000 translators.

SDL Trados Studio 2017 helps translators increase translation productivity whilst ensuring quality. Combining translation memory, terminology management and machine translation in one simple and easy-to-use environment.

More info »
SDL MultiTerm 2017
Guarantee a unified, consistent and high-quality translation with terminology software by the industry leaders.

SDL MultiTerm 2017 allows translators to create one central location to store and manage multilingual terminology, and with SDL MultiTerm Extract 2017 you can automatically create term lists from your existing documentation to save time.

More info »



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