Regex find/replace in Trados 2015
Thread poster: Samuel Murray

Samuel Murray  Identity Verified
Netherlands
Local time: 18:25
Member (2006)
English to Afrikaans
+ ...
Jan 25, 2016

Hello everyone

Is it possible in Trados 2015 to use regex replace to add some text (e.g. !!") in front of and to the end of each segment? In other words, what is the regex syntax for "start of segment" and "end of segment"?

Here's what I tried:

FIND: ^(.+)$
REPLACE: !!$1!!

SEGMENT: "<tag>" on page <tag>
(the <tag> is an actual tag in Trados, i.e. purple text)

The blog post here lead me to expect that ^ marks the start of the segment and $ marks the end of it, so I expected the above find/replace to result in this:

!!"<tag>" on page <tag>!!

Alas, it results in this:

!!"" on page !!<tag>

In other words, (1) it only selects up to the last bit of non-tag text in the segment, and (2) if the selection contains a tag, it removes the tag in the replacement.

What would the correct syntax be for what I'm looking for?

Thanks
Samuel


[Edited at 2016-01-25 16:02 GMT]


 

Dan Lucas  Identity Verified
United Kingdom
Local time: 17:25
Member (2014)
Japanese to English
Quirk of Studio regex implementation? Jan 25, 2016

Samuel Murray wrote:
In other words, (1) it only selects up to the last bit of non-tag text in the segment, and (2) if the selection contains a tag, it removes the tag in the replacement.
What would the correct syntax be for what I'm looking for?

Can't help myself Samuel, other than to confirm that as a C#-style (.NET) regex your regex seems to work fine on raw text. So it's a Studio issue. Interesting, if annoying.

Dan


 

SDL Community  Identity Verified
United Kingdom
Local time: 18:25
English
Could only be done... Jan 25, 2016

Samuel Murray wrote:

What would the correct syntax be for what I'm looking for?



... directly on the sdlxliff as you need to look for text. Regex only works on text.

Regards

Paul
SDL Community Support


 

Samuel Murray  Identity Verified
Netherlands
Local time: 18:25
Member (2006)
English to Afrikaans
+ ...
TOPIC STARTER
Thanks, Paul, for confirming it Jan 25, 2016

SDL Community wrote:
Samuel Murray wrote:
What would the correct syntax be for what I'm looking for?

Could only be done... directly on the sdlxliff as you need to look for text. Regex only works on text.


While it's true that regex only works on text, there is no programmatic reason why Trados could not support this: all it has to do, is let the find/replace dialog treat the segment not as-is but as "text in which tags are temporarily treated as textual elements".


 

Stepan Konev  Identity Verified
Russian Federation
Local time: 19:25
English to Russian
Additional question Jan 26, 2016

Recently, I was fiddling with regex search and replace function and found out that the replacement operation cannot be undone.

I replaced ANGLEBRACKETanytextANGLEBRACKET to empty vavue.
First, 'Replace _all_' did not work for _all_ instances. I had to ckick 'Replace all' five times before it reached the end of document.
Second, I could not undo this operation because the undo command was inactive (grayed out).

Can anybody confirm?

[Edited at 2016-01-26 06:17 GMT]


 


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


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

Regex find/replace in Trados 2015

Advanced search







WordFinder Unlimited
For clarity and excellence

WordFinder is the leading dictionary service that gives you the words you want anywhere, anytime. Access 260+ dictionaries from the world's leading dictionary publishers in virtually any device. Find the right word anywhere, anytime - online or offline.

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