Helping users not crash script when typing regex