[ticket/11323] Reduce additional code and revert regex to previous one

PHPBB3-11323