Quantcast
Channel: ProZ.com Translation Forums
Viewing all articles
Browse latest Browse all 822

Add a character to the end of every segment (regex) | Tricky solution ;-)

$
0
0
Forum: Transit support
Topic: Add a character to the end of every segment (regex)
Poster: Oiseau noir
Post title: Tricky solution ;-)

Hi Örjan,

it seems as if the end of segments is a kind of write-protected and therefore cannot be used in replace operations.

I have tried to use this effect for a tricky solution. It worked fine on a test file on my site, but I have no idea if it will work for your project too. So usage is on your own risk and please don't blame me if it doesn't work ;-)
It will be a very good idea to backup the language files before the following operation!

The solution consists of 3 separate Search-Replace operations:

1) Add a suffix XX behind any character:
Search: #(.)0
Replace by: #0XX

Attention -- may take a while (depending on your file sizes)
As suffix, you should use a string that does not occur in your "normal" text.

2) Remove the suffix before any character except the segment end.
Search: XX#(.)0
Replace: #0

This way, the XX remains only at the end of the segment (as this XXs are not a character).

3) Replease the remaining suffixes by the required character

Hope that helps.

By the way: I am curious -- what character do you need to be added? And why?

Best regards,

O.N.

Viewing all articles
Browse latest Browse all 822

Latest Images

Trending Articles



Latest Images