3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "text @user text @Губка Боб text @user1 text text @SiteTe.ru text text text @любитель text text @guba bob text text @geb 123"; if (preg_match_all('~(?=(?<!\S)(@.{0,29}))~u', $text, $matches)) { array_shift($matches); print_r($matches[0]); }

preferences:
55.26 ms | 402 KiB | 5 Q