#1 2016-11-22 12:17

bitseeker
Member
Registered: 2016-10-17
Posts: 16

make replace multiple items more readable/ better editable

Hi there,

i do have a lot of appreviations to replace - so i´m using the replace function with the multiple item separator.

But the more items i add, the less clearly it gets (e.g. positioning/deleting when changing etc. -> you have to count to get the right one...).

Is there a possibility to e.g. load a text file with the replace pairs in a more intuitive way - maybe like this:

abr1:extensive1
abr2:extensive2
abr3:extensive3
abr4:extensive4
...



or with any other (short) separator ('=>', '::', ...)


Right now it looks like your using some kind of array_replace function in the background based on the two input fields.


thx
Olli

Offline

#2 2016-11-22 12:53

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: make replace multiple items more readable/ better editable

You can use multiple replace rules, one for each replacement pair. This way you can add, remove and rearrange them easily.

Currently, it's not possible to import a list of search and replace couples formatted that way, i.e. find1:replace1, find2:replace2, etc.

You could reformat your list with two passes of RegEx tool, exacting all "find" parts first and then all "replace" parts in the format that the Replace rule expects. However, this may get quite tedious if performed often.

Does any of that suit you?

Offline

#3 2016-11-22 13:07

bitseeker
Member
Registered: 2016-10-17
Posts: 16

Re: make replace multiple items more readable/ better editable

well using one rule for each replacement pair doesn´t make it more comfortable to edit - same for regex.

Just thought about misusing the translit function ;o)
Would that work in your eyes (doesn´t replace recursively i hope)

Offline

#4 2016-11-22 14:20

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: make replace multiple items more readable/ better editable

bitseeker wrote:

Just thought about misusing the translit function ;o)

Translit rule can work quite well in certain cases. There are few key points to consider:

1) Translit rule automatically adjusts the case (upper/lower/capitalized) of the replacement part to match the source.

2) Translit rule doesn't have additional options which exist in the Replace rule, e.g. whole words only, wildcards, etc.

3) Translit rule explicitly avoids recursion, i.e. for each position in source, find first matching term and replace, adjust position in source to account for the replacement term.

Give it a try.

Offline

Board footer

Powered by FluxBB