We describe the design and implementation of a declarative database query language for manipulating character strings. The
language can be used to create logical predicates expressing structural properties of strings and relations between several
strings. The predicates can be used to query strings in databases, and by leaving variables uninstantiated, also to generate
new strings not contained in the database. A full working system was implemented as an extension of an object-oriented database
management system and its query language. The declarative expressions are evaluated by first performing a compilation transforming
them to nondeterministic finite state automata and then by simulating these automata using a depth-first search engine. The
system checks the safety of each string-manipulation query in advance to preclude infinite ones. This safety checking provides
also a compile-time loop-checking mechanism for the search engine, improving its efficiency.