Good day, dear experts! I began to study at my leisure RE. And I had a problem associated with the fact that would fold the compound words.
(?<=(Молоко)|(Хлеб)|(Тольятти))(.*)$
Input data:
Хлебзавод производит Хлеб это очень полезный и питательный продукт Молокозавод производит Молоко. продукт богатый кальцием Тольяттихлеб находиться в г. Тольятти на ул. Компартии 11 Тольяттихлеб находиться в г. Тольятти. на ул. Компартии 11 Тольяттихлеб находиться в г. Тольятти., на ул. Компартии 11
What I want to get on the output:
group(1)="Хлеб" group(2)=" это очень полезный и питательный продукт" group(1)="Молоко" group(2)=". продукт богатый кальцием" group(1)="Тольятти" group(2)=" на ул. Компартии 11" group(1)="Тольятти" group(2)=". на ул. Компартии 11" group(1)="Тольятти" group(2)="., на ул. Компартии 11"
And in fact it turns out:
group(1)="Хлеб" group(2)="завод производит Хлеб это очень полезный и питательный продукт" group(1)="Молоко" group(2)="завод производит Молоко. продукт богатый кальцием" group(1)="Тольятти" group(2)="хлеб находиться в г. Тольятти на ул. Компартии 11" group(1)="Тольятти" group(2)="хлеб находиться в г. Тольятти. на ул. Компартии 11" group(1)="Тольятти" group(2)="хлеб находиться в г. Тольятти., на ул. Компартии 11"
I would also be extremely grateful if I could suggest how to get rid of parasitic ones in the results: "gaps", "." ,".," etc. but it is not critical. I tried to use \ b but it does not work, if I correctly understood from the documentation, then in () it is considered as - backspace I also used the construct (, |. |) After the required word, it certainly works, but it seems to me that this is not quite beautiful the solution and there is an extra group () and I only have this problem with a couple of words from several dozen and because of them I don’t really want to rewrite the rest.