PostgreSQL String search for partial patterns removing exrtaneous characters
Posted
by tbrandao
on Stack Overflow
See other posts from Stack Overflow
or by tbrandao
Published on 2010-03-24T19:16:20Z
Indexed on
2010/03/24
19:33 UTC
Read the original article
Hit count: 306
Looking for a simple SQL (PostgreSQL) regular expression or similar solution (maybe soundex) that will allow a flexible search. So that dashes, spaces and such are omitted during the search. As part of the search and only the raw characters are searched in the table.:
Currently using:
SELECT * FROM Productions WHERE part_no ~* '%search_term%'
If user types UTR-1 it fails to bring up UTR1 or UTR 1 stored in the database.
But the matches do not happen when a part_no has a dash and the user omits this character (or vice versa)
EXAMPLE search for part UTR-1 should find all matches below.
UTR1
UTR --1
UTR 1
any suggestions...
© Stack Overflow or respective owner