Context
Using Ruby I parse the lines as follows:
Type with identifier ...
[Image=4b5da003ee133e8368000002]
[Video=679hfpam9v56dh800khfdd32]
... between 0 and n optional parameters shared with @ ...
[Image=4b5da003ee133e8368000002@size:small]
[Image=4b5da003ee133e8368000002@size:small@media:true]
In this example:
[Image=4b5da003ee133e8368000002@size:small@media:true]
I want to receive:
- [Image = 4b5da003ee133e8368000002 @ size: small @ media: true]
- Picture
- 4b5da003ee133e8368000002
- size: small
- Media: true
Problem
Right now using this regex:
(\[([a-zA-Z]+)=([a-zA-Z0-9]+)(@[a-zA-Z]+:[a-zA-Z]+)*\])
I get...
- [Image = 4b5da003ee133e8368000002 @ size: small @ media: true]
- Picture
- 4b5da003ee133e8368000002
- @media: true
What am I doing wrong? How can I get what I want?
PS: all the results are copied from http://rubular.com/ , which is nice to debug a regular expression. Please use it if it can help you help me :)
: , :
- [ = 4b5da003ee133e8368000002 @: @: ]
- 4b5da003ee133e8368000002
- @Size: @: