src/Utility/Text.php
public function explodeTags($tags) {
		// This regexp allows the following types of user input:
		// this, "somecompany, llc", "and ""this"" w,o.rks", foo bar
		$regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x';
		preg_match_all($regexp, $tags, $matches);
		$typedTags = array_unique($matches[1]);

		$tags = [];
		foreach ($typedTags as $tag) {
			// If a user has escaped a term (to demonstrate that it is a group,
			// or includes a comma or quote character), we remove the escape
			// formatting so to save the term into the database as the user intends.
			$tag = trim(str_replace('""', '"', preg_replace('/^"(.*)"$/', '\1', $tag)));
			if ($tag) {
				$tags[] = $tag;
			}
		}

		return $tags;
	}
public function explodeTags($tags) {
		// This regexp allows the following types of user input:
		// this, "somecompany, llc", "and ""this"" w,o.rks", foo bar
		$regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x';
		preg_match_all($regexp, $tags, $matches);
		$typedTags = array_unique($matches[1]);

		$tags = [];
		foreach ($typedTags as $tag) {
			// If a user has escaped a term (to demonstrate that it is a group,
			// or includes a comma or quote character), we remove the escape
			// formatting so to save the term into the database as the user intends.
			$tag = trim(str_replace('""', '"', preg_replace('/^"(.*)"$/', '\1', $tag)));
			if ($tag) {
				$tags[] = $tag;
			}
		}

		return $tags;
	}
public function explodeTags ( $ tags ) { // This regexp allows the following types of user input: // this, "somecompany, llc", "and ""this"" w,o.rks", foo bar $ regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x' ; preg_match_all ( $ regexp , $ tags , $ matches ) ; $ typedTags = array_unique ( $ matches [ 1 ] ) ; $ tags = [ ] ; foreach ( $ typedTags as $ tag ) { // If a user has escaped a term (to demonstrate that it is a group, // or includes a comma or quote character), we remove the escape // formatting so to save the term into the database as the user intends. $ tag = trim ( str_replace ( '""' , '"' , preg_replace ( '/^"(.*)"$/' , '\1' , $ tag ) ) ) ; if ( $ tag ) { $ tags [ ] = $ tag ; } } return $ tags ; }
Explode a string of given tags into an array.

@param string $tags
@return array
Explode a string of given tags into an array .