How can I check for a variable number of elements in a string?
[keyword1|keyword2|keyword3]
[keyword1|keyword2]
... or more than three keywords. This would just work for three elements:
preg_match("/^\[(.*)\|(.*)\|(.*)\]$/",$string, $matches)
Edit: How can I get the captured keyword in variables? i.e.:
matches[1] = keyword1
matches[2] = keyword2
matches[3] = keyword3