Regular expressions to find and replace
Thread poster: EstefaniaAlbert
EstefaniaAlbert
EstefaniaAlbert
Argentina
Local time: 06:29
English to Spanish
Sep 17, 2021

Hello!
I need help with regular expressions in Trados to find and replace.
I would like to:
- replace a decimal point with a decimal comma. That means to change only the dots that are between numbers (e.g. not final dots).
- replace regular space with a non-breaking space between a number and its unit symbol.

Can anybody help me creating the two expressions?

Thanks!!


 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 12:29
English to Russian
For example Sep 17, 2021

Find what: ([0-9])\.([0-9])
Replace with: $1,$2

Find what: ([0-9])\s([A-z])
Replace with: $1 $2

*To put a nbsp between $1 and $2, press and hold left Alt and type 0160 on your numpad, then release Alt.


 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 12:29
English to Russian
Also make sure you have this option set Sep 17, 2021

Sometimes it helps.2021-09-18_0234051

Elena Feriani
expressisverbis
Alexa Golova
 
EstefaniaAlbert
EstefaniaAlbert
Argentina
Local time: 06:29
English to Spanish
TOPIC STARTER
Thank you sooo much! Sep 18, 2021

Stepan Konev wrote:

Find what: ([0-9])\.([0-9])
Replace with: $1,$2

Find what: ([0-9])\s([A-z])
Replace with: $1 $2

*To put a nbsp between $1 and $2, press and hold left Alt and type 0160 on your numpad, then release Alt.


Thank you so very much! This helps me a lot and saves me so much time! Both expressions work perfectly.
Regarding the Trados option, it doesn't help me when, for example, I copy the source. And I tend to copy the source when I have many numbers! Hehehe


Stepan Konev
Elena Feriani
 
Anthony Rudd
Anthony Rudd

Local time: 11:29
German to English
+ ...
Regex Sep 19, 2021

Please do not write [A-z] to match alphabetic characters; this range also includes some non-alphabetic characters, such as [ \ ]. Use instead [A-Za-z] or \p{L}.

 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 12:29
English to Russian
Good notice. Thank you Sep 19, 2021

Anthony Rudd wrote:
Please do not write [A-z] to match alphabetic characters; this range also includes some non-alphabetic characters, such as [ \ ]. Use instead [A-Za-z] or \p{L}.
True, but this situation is very uncommon. And even when you have a number before \, [, or ], most probably you want to stick them together.
It is ok to have [ 90 ] in your text.
It is not ok to have [ 90
]



[Edited at 2021-09-19 17:04 GMT]


 
EstefaniaAlbert
EstefaniaAlbert
Argentina
Local time: 06:29
English to Spanish
TOPIC STARTER
Thank you! Sep 20, 2021

Anthony Rudd wrote:

Please do not write [A-z] to match alphabetic characters; this range also includes some non-alphabetic characters, such as [ \ ]. Use instead [A-Za-z] or \p{L}.


Thank you for this modification! I do work with texts that have, for example, "300 [M+H]", in which shouldn't be a non breaking space between 300 and [.
Thank you very much for your help.


 
youla
youla
Local time: 12:29
English to Greek
+ ...
I cannot make this work... Dec 3, 2021

I put the following expression in the "Find" text box exactly as it is below, as Stepan explained it:

([0-9])\.([0-9])

I used all brackets, backslash etc., but no results, although there were some in front of my eyes. I tried with and without brackets, with and without the backslash, still no results. I still use Studio 2017, maybe this is the reason?

Thank you in advance!

(P.S. I cannot post a screenshot for some reason. Everything is against
... See more
I put the following expression in the "Find" text box exactly as it is below, as Stepan explained it:

([0-9])\.([0-9])

I used all brackets, backslash etc., but no results, although there were some in front of my eyes. I tried with and without brackets, with and without the backslash, still no results. I still use Studio 2017, maybe this is the reason?

Thank you in advance!

(P.S. I cannot post a screenshot for some reason. Everything is against me today!)
Collapse


 
Francesco Varotto
Francesco Varotto  Identity Verified
Local time: 11:29
Member (2021)
English to Italian
+ ...
Check box Dec 3, 2021

@youla
Have you checked the box to find Regular expressions in the Find and replace window?


 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 12:29
English to Russian
Use regex checkbox Dec 3, 2021

youla wrote:

I put the following expression in the "Find" text box exactly as it is below, as Stepan explained it:

([0-9])\.([0-9])

I used all brackets, backslash etc., but no results, although there were some in front of my eyes. I tried with and without brackets, with and without the backslash, still no results. I still use Studio 2017, maybe this is the reason?

Thank you in advance!

(P.S. I cannot post a screenshot for some reason. Everything is against me today!)
Make sure you check the Use regex box.


 
youla
youla
Local time: 12:29
English to Greek
+ ...
Regular expressions box? Dec 13, 2021

Francesco Varotto wrote:

@youla
Have you checked the box to find Regular expressions in the Find and replace window?


Sorry for the late reply, I just saw your answer, I was expecting an email notification not did not get one.

Can you please post a screenshot? I cannot see this option in Studio 2017.

Thank you!


 
youla
youla
Local time: 12:29
English to Greek
+ ...
Regex? Dec 13, 2021

Stepan Konev wrote:

youla wrote:

I put the following expression in the "Find" text box exactly as it is below, as Stepan explained it:

([0-9])\.([0-9])

I used all brackets, backslash etc., but no results, although there were some in front of my eyes. I tried with and without brackets, with and without the backslash, still no results. I still use Studio 2017, maybe this is the reason?

Thank you in advance!

(P.S. I cannot post a screenshot for some reason. Everything is against me today!)
Make sure you check the Use regex box.


Sorry Stepan, I just saw this, no notification came.

I ticked the "Check regular expressions" Box in QA and saw the examples listed there (actually I clicked to see what they were and they were added and I cannot remove them)...

This project I am working on has come to me from a translation office, so I will pass the issue on to them.

Thank you anyway for your time and suggestions!


 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 12:29
English to Russian
Screenshot Dec 13, 2021

pastedimage1516786561175v3

 


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 to find and replace







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 »