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!)


I don't think that it is possible, because of CafeTran's handling of punctuation marks.


Yes, a regular expressions forum is useful: keep together what belongs together!


1 person likes this

|\d+,\d+% [TAB] 0.0%


isn't working

I think that it'll be a better approach to just use the Dutch notation and execute a F/R action with regular expressions at the end. This shouldn't be too difficult.

A F/R action with regular expressions at the end shouldn’t be too difficult, but on the other hand, it could also go terribly wrong ;)

Try once, if you've got it left/right (</>) make an AHK snippet!

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


Incidentally, I think you might be right about it being better to do the stupid numbers at the end. There are just way too many of them, and I have already wasted 20 minutes or more on just tables. 


I will also have a look what TransTools has to offer in this regard, and maybe contact Stanislav.

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

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.

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


if you got it right.

ach ja

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?

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



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

Seconded!


Kwang


Login to post a comment