' @\1.bsky.social', '/\ @([\w\d]+)@([\w\d_\-\.]+)/' => ' @\1', '/\ @([\w\d]+)/' => ' @\1' ); foreach ($data['links'] as &$value) { if (strpos($value['description'],' @') !== false) { foreach($patterns as $nic => $link) { $value['description'] = preg_replace($nic, $link, $value['description']); } } } return $data; }