This is because \ w * "eats" the stop word "_loop" before you verify that you do not check the word first (before \ w *), for example the following:
$pattern = '/\{((?!\w*_loop\})\w*)\}/';
or you can use ?< !:
$pattern = '/\{(\w*(?<!_loop))\}/';
source
share