Regular expression in Trados 2011 File Types > Inline Tags
Thread poster: Fong-chyi Wen
Fong-chyi Wen
Fong-chyi Wen  Identity Verified
Taiwan
Local time: 07:57
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
... See more
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
Collapse


 
Johan Kjallman
Johan Kjallman  Identity Verified
Local time: 00:57
Member (2008)
English 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
Fong-chyi Wen  Identity Verified
Taiwan
Local time: 07:57
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
Johan Kjallman  Identity Verified
Local time: 00:57
Member (2008)
English 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
Fong-chyi Wen  Identity Verified
Taiwan
Local time: 07:57
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
Johan Kjallman  Identity Verified
Local time: 00:57
Member (2008)
English to Swedish
+ ...
good! May 12, 2012

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

 
Vito Dipinto
Vito Dipinto  Identity Verified
Local time: 23:57
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

... See more
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
Collapse


 
Johan Kjallman
Johan Kjallman  Identity Verified
Local time: 00:57
Member (2008)
English 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 segme
... See more
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
Collapse


 
RWS Community
RWS Community
United Kingdom
Local time: 00:57
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
Wolf Kux  Identity Verified
Brazil
Local time: 20:57
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
Vito Dipinto  Identity Verified
Local time: 23:57
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







Anycount & Translation Office 3000
Translation Office 3000

Translation Office 3000 is an advanced accounting tool for freelance translators and small agencies. TO3000 easily and seamlessly integrates with the business life of professional freelance translators.

More info »
Trados Business Manager Lite
Create customer quotes and invoices from within Trados Studio

Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.

More info »