the title gives it all away:
I want this
To become this
with 1 single replace regexp operation and flexible, so that the same string also would work on a shorter or longer number like for example 10777524,62 .
I've worked really hard on figuring it out, including turning to manuals and tutorials, but sadly in vein.
Example 1: The closed I could come up with is this here, where I simplified by expressing 3 digit groups with a simple letter from the alphabet, to have it easier to understand what I'm doing there.
Query replace regexp (default \([0-9]\)\(n\)\(n\)\(n\)\(n\)\(n\)\(.\) -> \1,\2,\3,\4,\5,\6\7)
The idea: Grouping all 3 digit groups separately and referably, then replacing the whole match by reconstruction of it extended by desired changes - possible by spliting all relevant parts up in grouping constructs with round brackets.
But the problem is: It's fixed. Give the string a number with 5 n's - it works. Give it a smaller number, like for example, with just 3 n's - and it fails by not detecting it for a replace operation.
Example 2: Another example
Query replace regexp (default \([0-9]\)\(n\)\(.\) -> \1,\2\3):
Nice. But what about bigger numbers? Dealing with just 1 n is hard-wired into the string.
And what about applying '*' into it?
Giving a string like
Query replace regexp (default \([0-9]\)\(n*\)\(.\) -> \1,\2\3):
At least grabs the relevant part in one operation, no matter how many n's are part of it,
But instead of turning it into this
its output is this
So, you see: Regarding the finding part, it is capable to detect any number, no matter how many n's it consists of, but regarding the replacing part, it fails to apply the modification not just for 1 n, but for all n's it detected by * - here 3 times at once.
Any better ideas?