1.3.4.8.6 Comparison: Contains

The Contains comparison compares two values (String, String Array) and determines whether one value contains the whole of the other value, anywhere in the String. It therefore matches both exact matches, and matches where one of the values contains the other, but also contains extra information, either before or after the matching value.

Use the Contains comparison to find matches for String identifiers where values frequently contain extra information at either end of the String. The Contains comparison is particularly useful when matching names. For example, some people use their second name as their main identifier. This means it may be desirable to match "John Richard Smith" or "J Richard Smith" with "Richard Smith", which would not match using (for example) the Starts with or Exact String Match comparisons.

This comparison operation does not support the use of result bands.

The following table describes the configuration options:

Option Type Description Default Value

Match No Data pairs?

Yes/No

This option determines the result of a comparison when it compares two No Data (Null, or containing only whitespace characters) values for an identifier.

If set to No, the comparison will give a 'no data' result when comparing a No Data value against another No Data value.

If set to Yes, the comparison will give a full match (TRUE) when comparing a No Data value against another No Data value. A 'no data' result will only be returned if a No Data value is compared against a populated value.

No

Ignore case?

Yes/No

Sets whether or not to ignore case when comparing values.

For example, if case is ignored, "John Richard SMITH" will match "Richard Smith", which otherwise would not match.

Yes

Example

In this example, the Contains comparison is used to match people's names.

The following options are specified:

  • Match No Data pairs? = No

  • Ignore case? = Yes

A Trim Whitespace transformation is also added, to remove all whitespace from values before comparing them.

Example Results

The following table illustrates some example comparison results using the above configuration:

Note that if either value is empty, the comparison returns a 'No Data' result.

Table 1-39 Example Results: Contains

Value A Value B Comparison Result

J Richard Smith

Richard Smith

TRUE (match)

John Richard Smith

Richard Smith

TRUE (match)

R Smith

John R Smith

TRUE (match)

R Smith

J R Smith

TRUE (match)

John Smith

John Richard Smith

FALSE (no match)

R Smith

Richard Smith

FALSE (no match)

David E Jones

E J Jones

FALSE (no match)

Null

Oracle

no data

Null

Null

no data