<?php echo preg_replace('#\b(?:ab)+\b#', '!', 'ab abab abab abababab abea');
Standard input is empty
! ! ! ! abea
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!