The LIKE, REGEXP, and SIMILAR TO search conditions are similar in that they all attempt to match a pattern to a string. Also, all three attempt to match an entire string, not a substring within the string.
The basic syntax for all three search conditions is similar:
expression search-condition pattern
The difference between the LIKE, REGEXP, and SIMILAR TO search conditions lies in what you can specify for pattern. SIMILAR TO syntax for pattern allows a robust pattern matching using the regular expression syntax defined in the ANSI/ISO SQL standard. Regular expressions provide the capability for sophisticated pattern matching.
REGEXP supports a superset of regular expression syntax supported by SIMILAR TO. In addition, the REGEXP search condition supports a number of syntax extensions for compatibility with other products. Also, REGEXP and SIMILAR TO have a different default escape character.
The LIKE syntax for pattern is simple and supports a small set of wildcards, but does not support regular expressions.
For more information about the regular expression syntax supported by the SIMILAR TO and REGEXP search conditions, see Regular expressions.
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|