Start a new topic

regex to convert 36,49% to 36.49%

Can anyone help me with the regex to convert:


36,49%


to


36.49%


(we really need a subforum for regex stuff!)


Well, whatever Mr woorden (Hans van den Broek) thinks about these in general, the one Hans gave me, which I tried, worked perfectly, and saved me a lot of time in my current job. I have therefore saved it in my little regex templates file.


Of course, they don't all work, or always work perfectly, but then what does?


Michael

Perhaps we should give you a dedicated forum here?



HansCW: "Based on the other one (with $1 etc.) you can create the correct one for your specific number format."


I can. But you can't. It requires a mathematical mind, something most translators don't have.


I mentioned the replacement character $ months ago, and I was talking nonsense, according to you. And I was, it didn't (and doesn't?) work in tab dels.


H.

Hans,


I did a rough test.

It works flawlessly in my case.

(I did transfer all source segment to target segment).



Kwang


>HansCW: "I'll make sure to add some more examples to the wiki article."

 

>Please don't. They don't work


Then please don't use that particular one. Based on the other one (with $1 etc.) you can create the correct one for your specific number format.

HansCW: "I'll make sure to add some more examples to the wiki article."


Please don't. They don't work.



H.


Glad you like it all. Yes, these replacement variables are very powerful. Lots and lots of extra applications will be possible, e.g. replacing the period in the German date format by a dash. I'll make sure to add some more examples to the wiki article.

Seconded!


Kwang


Indeed, his little regex is amazing. Just ran it on my whole doc and it changed them all. I did use the Replace & Edit instead of the more dangerous Replace All, just in case.


Thanks so much Hans!!! You made my day.


-------------------------- ••• 

And now for a feature request: my text editor (EmEditor) has this cool little feature where you have drop-down menu in the F&R dialogue, in which you can store snippets for later use. It has stuff like TAB and newline characters, etc. If we had such a thing in CT, we could store all of our little regex text snippets there for quick and easy use on-the-fly.


I have one, for example, that I use a lot in the CT F&R dialogue:


If you are searching for a specific phrase in your glossary, but your glossary is quite big, and you want to locate only those entries that contain only what you're looking for. That is, let's say you're looking for the phrase ‘example word. So you only want to find entries in your glossary that contain only this phrase on the src side. So no stuff like ‘This is an example word’, ‘this is yet another example word’, or ‘extra special example word’. To do so, just search for this:


\Aexample word\t  


CT will display only those glossary entries that contain only this phrase.


This one is courtesy of Igor.


Michael

I'm about to suggest Michael to do find and replace in MS Word using wildcard.

But seeing Hans' latest post, I was thrilled.

I just replied you in another post about this replacement group.


Thank you, Hans. That's interesting.

So in fact we had this replacement group feature for so long right?

I'm so happy now.

The replacement groups are referred to by $1, $2 etc.:



This is not the official way, but for the time being you can use it:



This here doesn't work:



Igor, how should we write the Replace string?

ach ja

>What do you mean by, " if you've got it left/right (</>)"?


if you got it right.

Michael Beijer <michael@beijer.uk>

6:10 PM (0 minutes ago)

to Stanislav

Hello! 


Me again.


I have another question, about converting numbers. I’m currently wasting a lot of time in my CAT tool manually converting various currency amounts, and I’m wondering whether it might be faster to just leave them all in my CAT tool, and batch change them later in MS Word. It's stuff like this:


2,97 € 6,19 € 2,08

3,63 € 16,56 € 4,56

3,65 € 28,45 € 7,75

3,52 € 45,01 € 12,79


I want this to be:


2.97 €6.19 €2.08

3.63 €16.56 €4.56

3.65 €28.45 €7.75

3.52 €45.01 €12.79


That is: no spaces between the € and the number, and all commas changed to full stops.


I think this would fit into the functionality of your Correctomatic tool, under (a new Correction list) called something like "Dutch -> English punctuation/numbers, etc."


Michael

Login to post a comment