basic text processing algorithms, regular expression