[Passolo] How Do I Replace a String Using Regular Replace Expression
Thread poster: Exotic Hadron

Exotic Hadron
Russian Federation
May 22, 2013

Hello there,

Does anybody of you by chance know how do we use regular expressions in replace string in Passolo?
We need to a find an apostrophe in an Unicode alpha-numeric string and add an extra backslash before the apostrophe (this is necessary to escape the apostrophe symbol for that text).

Example:
The source string would be: TecтTest’ TestТест
Goal: TecтTest\’ TestТест
Obviously, the find expression should look like a combination of three classes:
([\p{L} \p{Nd}])(\’)([\p{L} \p{Nd}])
where
([\p{L} \p{Nd}]) — 1st and 3rd class of characters that includes all alphanumeric characters.
(\’) — the 2nd class that includes an apostrophe character only.

So that the replacement expression would be: $1\$2$3
where $n is nth class of characters.

Running a search’n'replace procedure in a special tool would give us: TecтTest\’ TestТест

So here goes the issue with Passolo. In Passolo it is NOT supported (to my knowledge) to use regular expressions in replace string. The application searches for the string using regular expression and replaces in with a flat sequence of characters.
If we used Passolo, for a given example we’d get:
TecтTes$1\$2$3 estТест

What it does, it cuts off by 1 neighboring characters next to the apostrophe and replaces the sequence with $1\$2$3!

Indeed instead of interpreting the replacement string Passolo treats it just as a text. What a behavior!

Any clue on fixing that? How would it be possible to do such a replacement in Passolo without scripting?

Thank you.


 

Achim Herrmann
Local time: 03:51
English to German
Some answers and additional tips May 23, 2013

I was not able to reproduce your problem. Maybe there are some differences in what apostrophe is in your text and expression and what is displayed in the web site of the blog. SDL Passolo IS supporting back references in the replace expression. I did a simple test replacing

(<)([^>]+)(>)
with
$1NEW$2NEW$3

and it works without problems as expected without inserting any unexpected literal text from the expression into the translation.

Maybe you can simplify your expression so that is only exchanges the apostrophe. Another solution depends on the file format. If you are localizing text files you can simply avoid the problem by inserting a mapping into the parser rule that automatically exchanges ' with \' when the target file is generated.

Achim Herrmann
SDL Passolo Business Consultant


 


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


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

[Passolo] How Do I Replace a String Using Regular Replace Expression

Advanced search







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 »
Protemos translation business management system
Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!

The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.

More info »



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