Remove global regex flag. Closes #397