I have the following regex:
var regex = @"\[(\w+)( (\w+)=""([^""]+)"")*\]";
This regex matches strings like:
[Name Parameter="Value" Parameter2="vv"]
[A B="3"]
So, first of all, I want to extend it so it'll match strings, when, if the value is one word, so you don't need a quotation mark before/after the value. For example:
[Name Parameter=OneWord]
I tried:
var regex = @"\[(\w+)( (\w+)=([^""]+))*\]";
but it's not working, so this is my first problem.
My second problem is, that I want to extend it so it'll match also if there are one or more whitespaces, comma, or comma and one or more whitespaces, but I have no idea how to do this.
Example:
[Name Parameter="SomeWord", p="v" a=b,c=4 P1="2"]
Any ideas?
Thanks.