Suppose I have a string like this in php(laravel):
make|aaa|select.aaa|ttt|actived_by(creator.url|test|ali)
Now I want to convert it to an array like this:
make
aaa
select.aaa
tttt
actived_by(creator.url|test|ali)
As you can see only pipe signs that are not included in brackets used to separation.
For that I wrote a function like this :
function parseQuery($query) {
preg_match_all("/[^\|]+/", $query, $match);
return $match;
}
But it has below output:
make
aaa
select.aaa
ttt
actived_by(creator.url
test
ali)
What is proper regex to use for desired result ?