# Modification to the list of string

Suppose we have a list of the following:

l={"applejuice","lemon_juiceginger"}


How can one modifies this to read as:

{"apple:juice","lemon_juice:ginger"}


I have tried StringRiffle[] but wasn't so successful.

• How do you determine where to insert the :? The example is not self-explanatory. – Szabolcs Jan 21 '19 at 14:19
• after each known word, apple is known so as juice. problem is with enteries like lemon_juice where there is "_". – Wiliam Jan 21 '19 at 14:21
• Assuming you need to detect and split words, have you tried any techniques from answers to your recent question: mathematica.stackexchange.com/q/189303/5478? – Kuba Jan 21 '19 at 14:21
• @William what kind of problem because "after each known word" means that "lemon_juiceginger" should be "lemon:_juice:ginger:". – Kuba Jan 21 '19 at 14:22
• @Kuba I have tried the method I asked in previous post. The "_" is the reason I am asking this here. Let me be specific. the ":" should go after the first known word. One expects "apple:juice" which is fine. Yet when there is "lemon_juiceginger" you get "lemon:_juiceginger" how would one sort the string such that it understand lemon_juice is one word? – Wiliam Jan 21 '19 at 14:25

We can use a slight modification of the function reArrange from this answer:
ClearAll[reArrange2]