Can AMPS filters do case-insensitive comparisons?

Yes!

For simpler comparisons, AMPS (starting with 5.2) supports case-insensitive functions such as STREQUAL_I for comparing two strings without regard to case and INSTR_I for locating one string inside another string without regard to case.

AMPS also supports UPPER and LOWER functions, which can be used to normalize the case of incoming fields.

For example, the following two filters are equivalent:

STREQUAL_I(/name, 'JANE')

UPPER(/name) = 'JANE'

When comparing multiple values, use the UPPER or LOWER functions. For example:

LOWER(/name) IN ('jane', 'george', 'carla', 'ferdinand')

For more complicated comparisons, or earlier versions of AMPS, AMPS filters support PCRE (perl-compatible regular expressions), which provide a wide variety of regex modifiers including a modifier to make matches case-insensitive.

In this case, you use the

(?i)

modifier to turn on case-insensitive matching.

Using this modifier, the following regular expression matches apple, Apple, appLE, aPpLe, or any other permutation of case:

(/pie/filling LIKE "(?i)ˆapple$")

See the AMPS User Guide for a brief overview of the modifiers avaialble. The PCRE documentation contains a full description of the regular expressions supported.

Last updated