# \[PHP, MySQL\] Comma delimited string parsing and concatenating... regex?

**URL:** <https://forum.kirupa.com/t/php-mysql-comma-delimited-string-parsing-and-concatenating-regex/191757>\
**Category:** programming\
**Created:** [June 22, 2006, 6:56pm UTC](https://forum.kirupa.com/t/php-mysql-comma-delimited-string-parsing-and-concatenating-regex/191757 "2006-06-22T18:56:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![redrum87](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@redrum87](https://forum.kirupa.com/u/redrum87)\
**Post date:** [June 22, 2006, 6:56pm UTC](https://forum.kirupa.com/t/php-mysql-comma-delimited-string-parsing-and-concatenating-regex/191757/1 "2006-06-22T18:56:50Z")

</div>

I’m working on a project using PHP and MySQL, and I’m trying to create a tagging system (for images, articles, etc). I need to parse a comma delimited string into separate records for a table in the database. Once they’re in the database, I want to display them elsewhere in a comma delimited string, which means I’ll need to concatenate the records.

I’m assuming the first part can be easily done using a regular expression, but alas, I don’t know how to write my own (yet). The second part I’m guessing should be done using the server side scripting language, because it seems like a SQL query either couldn’t get the job done, or could, but in a very messy way.

Any thoughts? Links? I’ve searched around quite a bit but I can’t seem to turn up anything (free, that is). Thanks.
