Hi,
I was wondering if anyone can help me parse tags.
This is what I currently do:
$tags = strtolower($tag_string);
$tags = preg_replace("/[^A-Za-z0-9 '_-]/","",$tags);
// remove superfluous whitespace
$tags = preg_replace("/\s\s+/", " ", $tags);
$tags_array = explode(' ', $tags);
$tags_array = array_filter($tags_array);
However, What i want to do, is account for tags in double quotes.
For example if I have the following string:
"My dog has four legs" (minus the quotes) I would get an array with each of those words as an element.
Now if I had the following tags:
" apple fruit "good food" citrus"
I want to array to contain :
apple
fruit
good food <-- this should be as a single tag
citrus
can anyone guide me on how to do that ?
Thanks