On Friday, 25 September 2015 at 07:40:18 UTC, Dmitry Olshansky wrote:
Removing anonymous groups and using raw-literal:

regex(`^\s*(\w+)\s*=\s*"(.*)"\s*$`)

Looks simpler I guess.

Good advice, thanks.

Though if key="value" is expected I'd suggest to use lazy .* - `"(.*?)"` to stop on first " if any.

After playing a bit with it, I realized that it doesn't work in this case (a="a"a" still match). The right solution would be "(.[^"])"

Reply via email to