bugfix regex infinite loop and resource eating