There is a line:
- Ivan Ivanov Ivanovich - rendered accommodation services (2-bed two-room Suite, Main place), catering services (Custom menu), medical services (Treatment), services related to the organization of tourist travel; 2. Petrov Petr Petrovich - accommodation services are provided (2-bed two-room Suite, Extra bed), catering services (Custom menu), services related to the organization of tourist travel (without medical services); 3. Semenov Semen Semenovich - medical services (Treatment), services related to the organization of tourist travel (without the provision of accommodation services, food services);
It is necessary with the help of a regular php expression to remove the text between ", services," and ";". That is, you need to get a string like:
- Ivan Ivanov Ivanovich - rendered accommodation services (2-seater two-room suite, main place), catering services (Custom menu), medical services (Treatment) 2. Petrov Petr Petrovich - rendered accommodation services (2-seater two-room suite, extra bed ), catering services (Custom menu) 3. Semenov Semen Semenovich - medical services are provided (Treatment)
I am writing this regular season, and only one entry is selected.
/, услуги,[^)]+;/
How to make all cases selected in a row? For convenience - link to https://regex101.com/r/VYmAld/1
preg_replace
tried? Your regular - working (I replaced)
on;
but it worked without it. Only on that site you need to use theg
flag, but in PHP it is enough topreg_replace
). Regex101 you even the code itself writes . - Wiktor Stribiżew