N
N
newbee2018-04-07 13:23:56
Regular Expressions
newbee, 2018-04-07 13:23:56

How to write such a regular expression?

How can you get all matches from a certain amount of text according to such a pattern?
Get the occurrence of the word "test1", then, after it, everything that is possible, any characters, in any sequence, and in any number, but only up to the first encountered word "test2" or, for example, "}}". The characters between these occurrences can be anything.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2018-04-07
@newbee

/^test\d+(.+)(?:test\d+|}})$/
Regex101

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question