' @\2.bsky.social', '/([^\S]+)@([\w]+)@([\w_\-\.]+)/' => ' @\2', '/([^\S]+)@([\w]+)/' => ' @\2' ); 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; }