Regular Expressions for Translators - Introduction
Thread poster: Shouguang Cao

Shouguang Cao
China
Local time: 21:26
Member (2007)
English to Chinese
+ ...
Jul 21

In this series of articles, I will try to write a tutorial that makes sense to us, not to coding monkeys

What is Regular expression

We all use search and replace feature. Regular expressions are simply using wild cards to search and/or replace. I suppose you know how to replace “cat” with “dog”, but if you want to replace all three-letter words ending with “at” like “hat”, “mat”, “rat” with “dog”, you will need the wild card. With regular expressions, you can search for something that is not exact but follows certain patterns. For example, search for a 8 digit telephone number.

How can it be useful to translators

When you are frustrated by repetitive work, there is likely a simpler, automatic solution with regular expressions. Before I explain, let’s do an experiment just to admire the miracle.
First all use this link to download “notepad++”.
https://notepad-plus-plus.org/download/v7.4.2.html

Now launch notepad++, copy/paste the text into a blank text file in notepad++.

I love this game.:Me encanta este juego.
I love regular expressions.:Me encantan las expresiones regulares.
Regular expressions are amazing.:Las expresiones regulares son asombrosas.
They do wonderful things.:Hacen cosas maravillosas.
(Spanish translation provided by Google Translate)


Use “CTRL+H” to open the search/replace dialog, and tick “Regular Expressions” under search mode section. Press CTRL+HOME to put your cursor at the beginning of the file.

Task one: You want to delete all the English source text. (Search for “.*:” and leave Replace With empty)
Task two: Or you want to delete all the Spanish text. (Search for “:.*” and leave Replace With empty)
Task three: Or you want to switch the position of “source:target” to “target:source”. (Search for “(.*):(.*)” and replace with “\2:\1”

Isn’t this amazing? In this tutorial we will always learn by experiment, so please keep your notepad++ open! Regular expressions can be complicated, but it's really easy to know the basics and and start using them. I have translation work to do right now, and will continue to write next week. Let me know if you are interested! And have confidence in yourself and in me. I once wrote a guide to linux iptables for dummies and people say it's easy and clear !

http://dallascao.com/cn/iptables-tutorial-for-newbies/

(in Chinese though, but look the replies. They are all real.)





[Edited at 2017-07-21 15:18 GMT]


Direct link Reply with quote
 
Maxi Schwarz
Local time: 07:26
German to English
+ ...
used how? Jul 21

I don't understand why I would search for "regular expressions" in the course of translating.

Direct link Reply with quote
 

Soonthon LUPKITARO(Ph.D.)  Identity Verified
Thailand
Local time: 20:26
Member (2004)
English to Thai
+ ...
Great idea Jul 23

Shouguang Cao wrote:

Now launch notepad++, copy/paste the text into a blank text file in notepad++.

I love this game.:Me encanta este juego.
I love regular expressions.:Me encantan las expresiones regulares.
Regular expressions are amazing.:Las expresiones regulares son asombrosas.
They do wonderful things.:Hacen cosas maravillosas.
(Spanish translation provided by Google Translate)


Use “CTRL+H” to open the search/replace dialog, and tick “Regular Expressions” under search mode section. Press CTRL+HOME to put your cursor at the beginning of the file.

Task one: You want to delete all the English source text. (Search for “.*:” and leave Replace With empty)
Task two: Or you want to delete all the Spanish text. (Search for “:.*” and leave Replace With empty)
Task three: Or you want to switch the position of “source:target” to “target:source”. (Search for “(.*):(.*)” and replace with “\2:\1”


I rarely apply the Regular Expression function. But I promote extensive use of it to enhance our productivity.
I am going to be 65 years old. This is why I need to move proactively.

Dr. Soonthon Lupkitaro
Bangkok, Thailand


Direct link Reply with quote
 

Shouguang Cao
China
Local time: 21:26
Member (2007)
English to Chinese
+ ...
TOPIC STARTER
not difficult after all Jul 23

With just a little practise of the basic syntax, everyone can use regular expressions to do something.



Soonthon LUPKITARO(Ph.D.) wrote:

Shouguang Cao wrote:

Now launch notepad++, copy/paste the text into a blank text file in notepad++.

I love this game.:Me encanta este juego.
I love regular expressions.:Me encantan las expresiones regulares.
Regular expressions are amazing.:Las expresiones regulares son asombrosas.
They do wonderful things.:Hacen cosas maravillosas.
(Spanish translation provided by Google Translate)


Use “CTRL+H” to open the search/replace dialog, and tick “Regular Expressions” under search mode section. Press CTRL+HOME to put your cursor at the beginning of the file.

Task one: You want to delete all the English source text. (Search for “.*:” and leave Replace With empty)
Task two: Or you want to delete all the Spanish text. (Search for “:.*” and leave Replace With empty)
Task three: Or you want to switch the position of “source:target” to “target:source”. (Search for “(.*):(.*)” and replace with “\2:\1”


I rarely apply the Regular Expression function. But I promote extensive use of it to enhance our productivity.
I am going to be 65 years old. This is why I need to move proactively.

Dr. Soonthon Lupkitaro
Bangkok, Thailand


Direct link Reply with quote
 


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


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

Regular Expressions for Translators - Introduction

Advanced search






Déjà Vu X3
Try it, Love it

Find out why Déjà Vu is today the most flexible, customizable and user-friendly tool on the market. See the brand new features in action: *Completely redesigned user interface *Live Preview *Inline spell checking *Inline

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

More info »



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