"Unknown modifier 'g' in..." when using preg_match in PHP?
There is no modifier g
for preg_match
. Instead, you have to use the preg_match_all
function.
So instead of:
preg_match("/^(\w|\.|-)+?@(\w|-)+?\.\w{2,4}($|\.\w{2,4})$/gim", ....)
use:
preg_match_all("/^(\w|\.|-)+?@(\w|-)+?\.\w{2,4}($|\.\w{2,4})$/im", ....)