Reputation: 6053
I have tried this:
(?=<).+(?<=>)
But it always matches the angular brackets too:
So how can I get the text without the brackets? (it should match any text between the brackets which fits in a line).
Upvotes: -1
Views: 448
Reputation: 43169
It's pretty easy, the .+ eats up everything up to the end of the line (remember, the dot matches everything including > and < here). Either use a lazy quantifier (demo)
.+
>
<
(?<=<).+?(?=>)
or a negated character class (demo)
<([^>]+)
Upvotes: 1