Synchronize event.setCanceled() for regex
Add "then cancel" to trigger event.setCanceled(true)
Code cleanup