A
A
Anton Ivanov2016-09-04 03:51:59
Regular Expressions
Anton Ivanov, 2016-09-04 03:51:59

How to specify in a regular expression that the end of one match should be used as the beginning of the next?

Hello!
There is a text.
Conventionally, it can be represented as follows:

Example: there is a lot of any
text with line breaks,
special characters, and so on. Example: i.e. unambiguous sampling of the text of the example cannot be done

We need to break it down into examples.
Regular: /Пример:.+?(?:Пример:|$)/mselects examples through one, since the word "Example" is used twice in each match. How can this be avoided?
The collective farm solution in the form of a regular expression /мер:.+?(?:При:|$)/mworks, but potentially it may not work, since "With:", theoretically, can occur in the middle of the text of the example
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Ivanov, 2016-09-04
@Fly3110

Thank you all :)
Earned and blunted. You can just break the text by the word "Example:" :) :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question