Course in regularity and automats