php - Regex values between brackets -


i want receive values between brackets array, don't working.

input:

hello, name {names.id1} , {user.age} , {hobby.name}. 

ouput:

array ( [0] ( [category] > "names"; [value] > "id1"; ) [1] ( [category] > "user"; [value] > "age"; ) [2] ( [category] > "hobby"; [value] > "name"; ) ) 

i made this, not working properly. can me out please?

/(\{([^\]]*)\.([^\]]*)\})/i 

http://regex101.com/r/ft2lw0

well typed braces instead of brackets...

/(\{([^}]*)\.([^}]*)\})/gi 

alternatively use

/{(.*?)}/gi 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -