Finding and replacing with variables - a generic procedure
Thread poster: Hans Lenting
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
Jun 9, 2018

As far as I know, this hasn't been documented elsewhere and since it is a very powerful way to modify your source or target segments, I'd like to share my findings here:

Screen Shot 2018-06-09 at 08.56.40

What you see here is a generic way to swap specified strings, in this case demonstrated with currency symbols (hence the names of the variables).

You can choose these names freely, best suited to your needs. Study the syntax, and save it somewhere (in TextExpander (!), Keyboard Maestro, AutoHotkey or just in a text document), for future reference.

Explanation of the generic patterns:

Find expression

(?string_to_find_one)(?string_to_find_two)(?string_to_find_three) ...

Where:
name_one (name_two ...) is the name that you want to assign to a string (word etc.) that you want to find.
string_to_find_one (string_to_find_two ...) is the regular expression that matches the string (word etc.) name_one (name_two ...).

Replacement expression

${name_one}${name_two} ...

Note that the ... is used here to indicate that additional parts are possible and that it's not part of the expression.
Note also that the brackets < and > are needed.

There are many other candidates for use of this technique.


  • Change the order of two or more parts of an expression
  • Delete one or more parts of an expression
  • Add any string between any parts of an expression
  • Add any string at the start or end of any part(s) of an expression, including any punctuation character(s)*)
  • And many more

You can find more info about the syntax of regular expressions in CafeTran:
https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

You can test your regular expression here:
http://www.regexplanet.com/advanced/java/index.html

Or here:
https://www.freeformatter.com/java-regex-tester.html

*) https://gist.github.com/davidjrice/9d2af51100e41c6c4b4a


[Edited at 2018-06-10 05:45 GMT]


 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
TOPIC STARTER
Wrong display Jun 13, 2018

I just noted that the info wasn't displayed correctly:

Explanation of the generic patterns:

Find expression

(?<name_one>string_to_find_one)(?<name_two>string_to_find_two)(?<name_three>string_to_find_three) ...

Where:
name_one (name_two ...) is the name that you want to assign to a string (word etc.) that you want to find.
string_to_find_one (string_to_find_two ...) is the regular expres
... See more
I just noted that the info wasn't displayed correctly:

Explanation of the generic patterns:

Find expression

(?<name_one>string_to_find_one)(?<name_two>string_to_find_two)(?<name_three>string_to_find_three) ...

Where:
name_one (name_two ...) is the name that you want to assign to a string (word etc.) that you want to find.
string_to_find_one (string_to_find_two ...) is the regular expression that matches the string (word etc.) name_one (name_two ...).

Replacement expression

${name_one}${name_two} ...

Note that the ... is used here to indicate that additional parts are possible and that it's not part of the expression.
Note also that the brackets < and > are needed.
Collapse


 


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

Moderator(s) of this forum
Natalie[Call to this topic]

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

Finding and replacing with variables - a generic procedure






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 »
Wordfast Pro
Translation Memory Software for Any Platform

Exclusive discount for ProZ.com users! Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value

Buy now! »