Regular expresion not match all groups

Viewed 8

Why only the last one item matched (12,23,34), not all?

expression:

(header(?:.+?)\n)(-item(?:.+?)\n)+

input:

header1
-item11
-item12

header2
-item21
-item22
-item23

header3
-item31
-item32
-item33
-item34

https://regex101.com/r/tNZhnZ/2

0 Answers
Related