I want to create a match only if an additional quantity condition is true.
Example (which is fine):
Regex: -(START.*?)_\d+(?=-END)
Input: test-START_one_two_three_4-END
Match Group1: START_one_two_three
Anyways I want to add an additional check that inside the group match, there should be _{3,4}
characters. But not followed by each other directly.
So I'd have to create an additional non-capturing group with (?:...)
.
What I tried: looking 4 times for _*
until the -END
:
(?:(?:_[^_]*){4}-END)
But adding this into the regex won't create a match anymore. Why?