Re: Syntax for wildcard selection
От | John Clark Naldoza y Lopez |
---|---|
Тема | Re: Syntax for wildcard selection |
Дата | |
Msg-id | 3B7B2131.7FF2F3FE@ntsp.nec.co.jp обсуждение исходный текст |
Ответ на | Re: Syntax for wildcard selection (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: Syntax for wildcard selection
|
Список | pgsql-general |
Bruce Momjian wrote: > > > This question just came up from a user use to our Informix application. They > > tried to do a wildcard search, thus "where field_name LIKE 'AB%VN'". The > > trailing values (after the %) are not recognized correctly. With Informix > > 4GL, we wrote "where field_name MATCHES 'AB*VN'". This finds any combination > > of values with 'AB' as the first two characters, and 'VN' as the last two, > > with any number of characters in between - including blanks. How is this > > accomplished with PostgreSQL? Are we limited to wildcard searches as "where > > field_name LIKE 'AB%'"? > > Trailing stuff should always be recognized, and I am sure PostgreSQL > does this. > Perhaps regular expression may help you out... WHERE field_name ~ '^AB' AND field_name ~ 'VN$' You should also only process those that have greater than four characters in the field_name...;-) Hope that helps...;-) Cheers, John Clark -- /) John Clark Naldoza y Lopez (\ / ) Software Design Engineer III ( \ _( (_ _ Web-Application Development _) )_ (((\ \> /_> Cable Modem Network Management System <_\ </ /))) (\\\\ \_/ / NEC Telecom Software Phils., Inc. \ \_/ ////) \ / \ / \ _/ phone: (+63 32) 233-9142 loc. 3113 \_ / / / cellphone: (+63 919) 399-4742 \ \ / / email: njclark@ntsp.nec.co.jp \ \ "Intelligence is the ability to avoid doing work, yet getting the work done" --Linus Torvalds
В списке pgsql-general по дате отправления: