<?php $re = '/(?<=<@!).+?(?=>)/m'; $str = "Hey <@!123456789> thanks for that, I'll get back to you sooon."; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); // flatten the array result (otherwise it's an array of arrays) $matches = array_merge(...$matches); // Print the entire match result print_r($matches); //Array ( [0] => 123456789 )
You have javascript disabled. You will not be able to edit any code.