Подскажите регулярку пожалуйста

MaxLucky

Client
Регистрация
13.08.2017
Сообщения
165
Благодарностей
13
Баллы
18
Нужно отсечь последнее предложение в переменной. И обязательно условие, чтобы отсекаемое предложение начиналось через точку и сразу текст. Без пробела.

Пример:

"What is meant by ovarian follicle?

time or another, eggs in ovarian follicles (i.e., developing eggs); it undergoes fluctuations in size and appearance that correlate with stages of the reproductive cycle. The cortex also contains remnants of ovulated follicles and, in mammals, clusters of interstitial cells that, in some species, are glandular.ovarian follicle | anatomy - Encyclopedia Britannica"

Нужно отсечь: "ovarian follicle | anatomy - Encyclopedia Britannica". И тексты разные будут в работе, поэтому условие должно обязательно учитываться.
 

fridayman

Client
Регистрация
25.03.2018
Сообщения
169
Благодарностей
259
Баллы
63
.*\.

92429
 
  • Спасибо
Реакции: MaxLucky

kagorec

Client
Регистрация
24.08.2013
Сообщения
931
Благодарностей
484
Баллы
63
What is meant by ovarian follicle?

time or another, eggs in ovarian follicles (i.e., developing eggs); it undergoes fluctuations in size and appearance that correlate with stages of the reproductive cycle. The cortex also contains remnants of ovulated follicles and, in mammals, clusters of interstitial cells that, in some species, are glandular.ovarian follicle | anatomy - Encyclopedia Britannica
Взять последнее предложение из любой статьи (предложения могут оканчиваться на "." или "!" или "?" или "!?")
C#:
(?<=[\.\?\!]+\ ).*?$
п.с. возможно пригодиться)
 
  • Спасибо
Реакции: fridayman и MaxLucky

MaxLucky

Client
Регистрация
13.08.2017
Сообщения
165
Благодарностей
13
Баллы
18
С тем примером прокатило.

Однако с текстом, где после точки с большой буквы начинается предложение, регулярка не подходит.

Пример:

"Commonly, the follicle cells are attached to the oocyte. Follicle cells play an important role in oocyte degeneration. In particular, the functions of follicle cells during oocyte degeneration are associated with phagocytosis and the intracellular digestion of products.Oocyte Degeneration Associated with Follicle Cells in Female Mactra ..."

Тут нужно отсечь "Oocyte Degeneration Associated with Follicle Cells in Female Mactra ..."
 

fridayman

Client
Регистрация
25.03.2018
Сообщения
169
Благодарностей
259
Баллы
63
Пригодилось!

С тем примером прокатило.

Однако с текстом, где после точки с большой буквы начинается предложение, регулярка не подходит.

Пример:

"Commonly, the follicle cells are attached to the oocyte. Follicle cells play an important role in oocyte degeneration. In particular, the functions of follicle cells during oocyte degeneration are associated with phagocytosis and the intracellular digestion of products.Oocyte Degeneration Associated with Follicle Cells in Female Mactra ..."

Тут нужно отсечь "Oocyte Degeneration Associated with Follicle Cells in Female Mactra ..."
Я наколдовал регулярку, но не подскажу, как ее адаптировать в ZP.

Выглядит она вот так:
C#:
(?<=[\.\?\!]+).*?\.*
Проверить можно на https://regex101.com/

2022-05-28_15-42-20.png
 

MaxLucky

Client
Регистрация
13.08.2017
Сообщения
165
Благодарностей
13
Баллы
18

MaxLucky

Client
Регистрация
13.08.2017
Сообщения
165
Благодарностей
13
Баллы
18

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)