Testing whether a language is regular or not