Regular expression in Trados 2011 File Types > Inline Tags
Thread poster: Fong-chyi Wen

Fong-chyi Wen  Identity Verified
Taiwan
Local time: 05:53
Member (2008)
English to Chinese
May 11, 2012

Hi, everyone,

I am not very tech savvy, so regular expression is always like a mystery to me. I know how to use ^p or ^t to indicate paragraph or tab symbols, but for other more complicated cases, I am totally useless. I have a doc that contains a lot of variables like %{count}, %{yearly_price}, and others. They all start with a percentage symbol appended by a pair of brackets with one or several words inside. I tried various combination and found some resources, but I still failed to convert them into tags. This is one of my trys: %\{[\w-]\}. Can anyone tell me what did I do wrong? Thanks a lot.

Regards,

Fong-chyi Wen


 

Johan Kjallman  Identity Verified
Local time: 23:53
Member (2008)
Italian to Swedish
+ ...
try this May 12, 2012

Hi,

I'm not good at regex either, so there is probably a cleaner way to write it. This works on my system though, so you may want to try it:
%\{[^\{]+\}

BR/Johan

(edit: removed a redundant character)

[Edited at 2012-05-12 14:42 GMT]


 

Fong-chyi Wen  Identity Verified
Taiwan
Local time: 05:53
Member (2008)
English to Chinese
TOPIC STARTER
Thank you. May 12, 2012

Hi, Johan,

Thanks a lot. I will try it and figure out the rule behind this.

Regards,

Wen

Johan Kjallman wrote:

Hi,

I'm not good at regex either, so there is probably a cleaner way to write it. This works on my system though, so you may want to try it:
%\{[^\{]+\}

BR/Johan

(edit: removed a redundant character)

[Edited at 2012-05-12 14:42 GMT]


 

Johan Kjallman  Identity Verified
Local time: 23:53
Member (2008)
Italian to Swedish
+ ...
good luck! May 12, 2012

The middle part of the expression [^\{] is needed when you have two or more occurrences per segment, in order to not catch a long string containing the first and the last variable and all regular text in between.
ps.
I can really recommend Expresso for learning and creating regular expressions.
http://www.ultrapico.com/Expresso.htm

/Johan


 

Fong-chyi Wen  Identity Verified
Taiwan
Local time: 05:53
Member (2008)
English to Chinese
TOPIC STARTER
It worked and thank you very much. May 12, 2012

Hi, Johan,

I just tried it with the file and it worked like a charm. Thank you very much. I will try the tool you mentioned, too, and learn more from it. Have a great weekend!!

Regards,

Wen

Johan Kjallman wrote:

The middle part of the expression [^\{] is needed when you have two or more occurrences per segment, in order to not catch a long string containing the first and the last variable and all regular text in between.
ps.
I can really recommend Expresso for learning and creating regular expressions.
http://www.ultrapico.com/Expresso.htm

/Johan


 

Johan Kjallman  Identity Verified
Local time: 23:53
Member (2008)
Italian to Swedish
+ ...
good! May 12, 2012

Glad to hear that it worked, have a nice weekend you too! /Johan

 

Vito Dipinto  Identity Verified
Local time: 22:53
English to Italian
+ ...
regex Jul 1, 2012

Hi everybody,

I am trying to localise a LNG file and I need trados to show just the part of the text that come after the = symbol. I know I can use regex but even using Espresso to create my regular expression, I don't success.

Any idea about the regex I could use?

OptimizingPars=Optimizing paragraph structure
GettingParData=Getting paragraph data
AnalyzingPars=Analyzing paragraph structure
RemovingPars=Removing paragraphs

This is the kind of strings I have.

many thanks
Vito


 

Johan Kjallman  Identity Verified
Local time: 23:53
Member (2008)
Italian to Swedish
+ ...
turn the first part into tags? Jul 1, 2012

Hi Vito,

I'm not using Studio, so I don't know if it's possible to hide text from translation from within the software (but I doubt it). How about using a very simple regex to turn the first part of the strings into a tag? Something like this could perhaps work if the pattern is always the same?

.+=

It might need to be fine tuned depending on the rest of the text, if for example "=" is used in other contexts or if it occurs more than once in the same segment.

If you want to turn those parts into external tags, perhaps you could use Preptags?
http://www.your-translations.com/preptags.php
I'm not familiar with LNG files though, so I'm not sure if it's doable.

Just a thought /Johan


 

SDL Community  Identity Verified
United Kingdom
Local time: 23:53
English
Create a custom regex filetype Jul 1, 2012

Hi Vito,

One way to tackle this is to create a custom regex based filetype. So go to Tools - Options - Filetypes and create your regex based filetype in there.

I did a very quick video as I tested this and thought it would be the easiest way to show you.

http://youtu.be/LYYy-zmj324

Regards

Paul


 

Wolf Kux  Identity Verified
Brazil
Local time: 19:53
Member (2006)
German to Portuguese
+ ...
Try this ... Jul 1, 2012

timber2380 wrote:

Hi everybody,

I am trying to localise a LNG file and I need trados to show just the part of the text that come after the = symbol. I know I can use regex but even using Espresso to create my regular expression, I don't success.

Any idea about the regex I could use?

OptimizingPars=Optimizing paragraph structure
GettingParData=Getting paragraph data
AnalyzingPars=Analyzing paragraph structure
RemovingPars=Removing paragraphs

This is the kind of strings I have.

many thanks
Vito



I suppose you may do a text separation between text left of equal sign from the text right of it.

First of all, find out on your source file a character like "\";"|";"@";"#";"$";"§", etc. (that usually never appears on text) to be used instead of the "=" character and change "=" with it ;

move all sentences to a new Text file (e.g. MYFILE.TXT); (select all; Ctrl-C; Ctrl-V);

open Excel (yes, Excel from MS-Office!) , load MYFILE.TXT (i. e. "open" that text file) - when doing this, Excel asks for patterns to load that text file;

one of the items Excel asks, is a column separator - here you inform this character you used;

after Excel loaded this file, you may have on Column A all of the text from left of the previous "=", and on Column B all right of it.

Work on Trados using a copy of this Excel file without column A, that is, only text right of previous "=";

After translation done, generate Excel output file and move translated text back to column B on generated Excel file before you worked on Trados.

During work on Trados, do not merge lines!

Seems complicated, but it is easy.

HTH




[Editada em 2012-07-01 17:31 GMT]

[Editada em 2012-07-01 17:35 GMT]

[Editada em 2012-07-01 18:33 GMT]

[Editada em 2012-07-01 19:45 GMT]


 

Vito Dipinto  Identity Verified
Local time: 22:53
English to Italian
+ ...
many thanks Jul 24, 2012

Hi Paul,

Many thanks for your video. A few days later I asked for help, I found one of your videos about regular expressions on the internet and I managed to do what you show me in the video.
Many many thanks!!!

Vito


 


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


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

Regular expression in Trados 2011 File Types > Inline Tags

Advanced search







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

SDL Trados Studio 2019 has evolved to bring translators a brand new experience. Designed with user experience at its core, Studio 2019 transforms how new users get up and running and helps experienced users make the most of the powerful features.

More info »
memoQ translator pro
Kilgray's memoQ is the world's fastest developing integrated localization & translation environment rendering you more productive and efficient.

With our advanced file filters, unlimited language and advanced file support, memoQ translator pro has been designed for translators and reviewers who work on their own, with other translators or in team-based translation projects.

More info »



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