more flexible regexp for detecting language