Похожие чаты

So guys, little regex question: I have a regex that

should catch:

[=foo]
[="foo"]
[='foo']

the begin and the end have to be the same so I'm gonna to capture the quotes and call it at the end with \1. The question mark it's used to accept also no quotes

\[=(['\"]?)(.+)\1\]

working fine if I try it on one row, but when I try to write anything else and call a closure bracket it's going to match until that bracket. Some examples of the behaviours: https://regex101.com/r/4qYzyS/1

Anyone have a solution? To match the 3 patterns that I want without conflicts?

1 ответов

14 просмотров

Use lazy .+?

Похожие вопросы

Карта сайта