find & replace

For all things Mellel

Moderators: Eyal Redler, redlers, Ori Redler

Post Reply
Bulow
Knows everything, can prove it
Posts: 161
Joined: Tue Nov 25, 2008 11:49 am
Location: Paris (sometimes Copenhagen)

find & replace

Post by Bulow »

In a series of measurements I want to correct points into commas, i.e. 12.5 should be 12,5. I can easily find them by searching 'digit'.'digit', but then I have a problem: if I replace by 'found expression','found expression' 12.5 will be replaced by 12.5,12.5.
Does anyone know how this could be done?
Bülow
Eyal Redler
Co-founder
Posts: 695
Joined: Thu Oct 27, 2005 9:15 am

Re: find & replace

Post by Eyal Redler »

What you need to do is to place each digit in a group and then in the replace expression use back references.
Find: [digit].[digi] (where [ denotes a group)
Replace: [<1],[<2]
Eyal Redler
----------------------
Co-Founder and Owner at Mellel
Facebook: http://www.facebook.com/mellelwordprocessor
YouTube: http://www.youtube.com/user/MellelRedlex
Donate: https://www.paypal.com/donate/?hosted_b ... 2LWB33YBZW
Bulow
Knows everything, can prove it
Posts: 161
Joined: Tue Nov 25, 2008 11:49 am
Location: Paris (sometimes Copenhagen)

Re: find & replace

Post by Bulow »

Hm, searching [digit].[digit] gives 'nothing found'. I have tried several combinations with or without brackets, but nothing gives the desired result.
Eyal Redler
Co-founder
Posts: 695
Joined: Thu Oct 27, 2005 9:15 am

Re: find & replace

Post by Eyal Redler »

Sorry about that, I didn't mean for you to use actual brackets but rather use the special group brackets which you get if you select a part of the expression and choose "Group" from the popup menu on the side of the find field.

More detailed explanation:

Find expression:
1. Insert a "digit" element to the find field - give it the "once or more" option
2. Select the digit element and choose "Group" from the popup to the left of the find field this will wrap the digit element with a group brackets note that the group also has a number - this will 1 for the first group.
3. Type a period after the group
4. Insert a "digit" element (give it the "once or more" option)
5. Select the second digit and Choose "Group" - note that this group has the number 2

Verify that the expression finds the elements you're expecting

Replace:
1. Insert a "back reference" element from the popup to the left of the field
2. Type comma
3. Insert another back reference element
4. Double click the second back reference element and choose 2 in the popup
This should do the work.
Eyal Redler
----------------------
Co-Founder and Owner at Mellel
Facebook: http://www.facebook.com/mellelwordprocessor
YouTube: http://www.youtube.com/user/MellelRedlex
Donate: https://www.paypal.com/donate/?hosted_b ... 2LWB33YBZW
Bulow
Knows everything, can prove it
Posts: 161
Joined: Tue Nov 25, 2008 11:49 am
Location: Paris (sometimes Copenhagen)

Re: find & replace

Post by Bulow »

Thank you Eval, it works, but I would never have got there on my own.
Post Reply