I'm trying to get every value in quotes using regex, in some situations I get it and others I don't.
My Regex: /(?:-reason|-r) ?"(.+?)(?:"-|" -|"?$\B)/g
Below are some sentences I've been testing, line 1 and 2 match regex, but line 3 doesn't.
1 anything -reason "some reason" -anyArg "anything"
2 anything -reason "Hello World, you're the "best"" -anyArg "anything"
3 anything -r "anything "here" is wrong" anything
The last sentence of the image is not compatible with the regex, what do I do to make the regex match them all?