I
I
iol772019-02-03 08:28:23
Regular Expressions
iol77, 2019-02-03 08:28:23

What regular expression can be used to replace the same characters, except for the first one?

I'm trying to complete the task in sublime text, but any solution will do.
There is a dictionary of synonyms for the species

контура|силуэта|абриса|профиля
контурам|силуэтам|абрисам|профилям
контурами|силуэтами|абрисами|профилями
контурах|силуэтах|абрисах|профилях
контуре|силуэте|абрисе|профиле

need to bring it to mind
контура|силуэта,абриса,профиля
контурам|силуэтам,абрисам,профилям
контурами|силуэтами,абрисами,профилями
контурах|силуэтах,абрисах,профилях
контуре|силуэте,абрисе,профиле

those. replace with a comma in the string all | except for the first one.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
forspamonly2, 2019-02-03
@iol77

Not every regexp engine can do it with one regexp.
for example, this: https://regex101.com/r/zvs6Nq/1 works in chrome, but not in firefox.
it is probably easiest for you to do it in several passes - to drive the replacement of the second stick in a row until they stop being replaced.
https://regex101.com/r/zvs6Nq/3/

I
iol77, 2019-02-09
@iol77

Thanks everyone, sublime text handled both suggested regular expressions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question