Using the MATCHES keyword (but outside a WHERE clause)
Posted in 1996
Is it likely that the MATCHES keyword will continue to be able to be used to search for a substring within a string variable? The 4gl program listed below displays the proper message ("found" or "NOT found") when MATCHES is used to search a string for a substring. It works both in compiled and p-code. Tested with: INFORMIX-4GL Version 4.10.UD3 and INFORMIX-4GL Version 4.13.UD1 main define char_str char(40) define i smallint for i = 1 to 4 case when i = 1 let char_str = "1=1" when i = 2 let char_str = "2=2" when i = 3 let char_str = "hello 1=1" when i = 4 let char_str = "1=1 goodbye" end case display "char_str: ", char_str if char_str MATCHES "*1=1*" then display " MATCHES test: *1=1* found in string." else display " MATCHES test: *1=1* NOT found in string." end if end for end main -- Colin McGrath <Standard disclaimers apply> Internet: cmm@trac3000.ueci.com Voice: 215-422-4144 FAX: 215-422-1445