Forum OpenACS Development: String matching
I need to match a keyword with every record on table tag_tags (i.e. tags pkg)
POSIX-style regular expressions is the approach I've written so far.
Is there any better option?
Tip: If you have pattern matching needs that go beyond this, consider writing a user-defined function in Perl or Tcl.
There are three separate approaches to pattern matching provided by PostgreSQL: the traditional SQL LIKE operator, the more recent SIMILAR TO operator (added in SQL:1999), and POSIX-style regular expressions. Aside from the basic "does this string match this pattern?" operators, functions are available to extract or replace matching substrings and to split a string at matching locations.
I know full-text searching works well with tsearch2 (oacs pkg). I'll need to build the integration though. https://openacs.org/doc/tsearch2-driver/
Is that path you were trying to go?
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.