- preg_match_all: documentation ( source)
- var_export: documentation ( source)
<?php
$field_from_db = 'Hello How are you :slight_smile::joy::_do_not_match:test test::';
$regex = '/:[a-z0-9]+(?:[-’_][a-z0-9]+)*:/i';
preg_match_all($regex, $field_from_db, $matches);
var_export($matches[0]);