Forum OpenACS Development: Re: String matching
Secondly, you can use the PostgreSQL full text search no only via the OpenACS tsearch2 package, but for arbitrary tables. See e.g.  or  on tutorials on tsvector and tsquery.
Thirdly, there is a long history of research, how to implement "near matches" like soundex, Levenshtein distances , trigrams , which are supported directly by PostgreSQL, and there are many more like e.g. Jaro Winkler, cosine distances, Smith-Waterman-Gotoh (sequence alignment), and many more via the pg_similary  extension.
PostgreSQL has a great array of capabilities in this area. It is typically much better to select data from database with such filters than to load everything into memory and to filtering on the application layer.