I've been trying to extract something inside a string. I got the follwing string :
*, bob, DATE('gdfgfd', 'Fdsfds', ('fdsfdfsd')), george
I want to split by commas outside parentheses and it is suppose to give this:
[
"*",
"bob",
"DATE('gdfgfd', 'Fdsfds', ('fdsfdfsd'))",
"george"
]
I've been trying to use explode but it cut even inside ( and ) ... logic by the function mean.
So I've did this : [^(,\s]+|\([^)]+\) but it give cut even if a commas is found inside bracket.
Anyone know how to do what I mean?
EDIT :
Ok to be very clear and direct.
I got this : SELECT MyField, Field2, Blabla, Function(param), etc FROM table Blabla
I got the string MyField, Field2, Blabla, Function(param), etc already because the query is done by multiple function class like $DB->Select('MyField, Field2, Blabla, Function(param), etc'); but now I want to parse everything between commas so MyField, Field2, Blabla, Function(param), etc become this :
- MyField
- Field2
- Blabla
- Function(param)
- etc