We consider several basic problems for texts and show that if the input texts are given by their Lempel-Ziv codes then the problems can be solved deterministically in polynomial time in the case when the original (uncompressed) texts are of exponential size. The growing importance of massively stored information requires new approaches to algorithms for compressed texts without decompressing. Denote by LZ(w) the version of a string w produced by Lempel-Ziv encoding algorithm. For given compressed strings LZ(T), LZ(P) we give the first known deterministic polynomial time algorithms to compute compressed representations of the set of all occurrences of the pattern P in T, all periods of T, all palindromes of T, and all squares of T. Then we consider several classical language recognition problems: •regular language recognition: given LZ(T) and a language L described by a regular expression, test if T ∈ L, •extended regular language recognition: given LZ(T) and a language L described by a L.Z-compressed regular expression, test if T ∈ L, the alphabet is unary, •context-free language recognition: given LZ(T) and a language L described by a context-free grammar, test if T ∈ L, the alphabet is unary. We show that the first recognition problem has a polynomial time algorithm and the other two problems are MV-hard. We show also that the LZ encoding can be computed on-line in polynomial time delay and small space (i.e. proportional to the size of the compressed text). Also the compressed representation of a pattern-matching automaton for the compressed pattern is computed in polynomial time.