Re: String manipulation
Posted in 1998
Ronnie Diaz wrote in message <3654ADB6.5875DCA7@appsig.com>... >This is going to any informix wizards out there. > >I understand that when you use MATCHES for a select query, you can do >something like [Ff] to choose >between two different characters. Is there a way where you can do the >same thing with a string... for example >"I have your [(blue)(yellow)(green)] [(automobile)(car)]" would MATCH "I >have your yellow automobile" or "I have your green car", but not "I have >your purple car"? > >I'm trying to do this in server-side javascript and java, and the only >thing I can think of is creating some loop, but that would mean LOTS of >querying. > Standard SQL that would solve your specific example would be something like: WHERE (column MATCHES "*blue*" OR column MATCHES "*yellow*" OR column MATCHES "*green*") AND (column MATCHES "*automobile*" OR column MATCHES "*car*") This is never going to be fast (our clues being the asterisk at the start of a quote and the use of OR), but will work. You might want to look into IDS/UDO (a-hem! Informix Dynamic Server with Universal Data Option). There's a text datablade that is designed just for this sort of complex string interregation.