I am trying to get attributes from a BBCode using regular expression Lets say I have those strings:
[icons a="1" b='2' c="3"]
[icons d="4" e='5' f="6"]
I need using a regular expression to get matches like this:
[
{'a', '1', 'b', '2', 'c', '3'},
{'d', '4', 'e', '5', 'f', '6'}
]
I figured this regular expression:
\[icons[\w\s](?:(\w*)\=["|']([^"|']*))+.*?\]
But it only matches:
[
{'a', '1'},
{'d', '4'}
]
How I can match all the attributes?
Also, just to make it more bullet proof, is there a way to match only the quote it found?
[icons a="1"] // GOOD
[icons a="1'] // BAD - But still a match