Skip to main content

TextMatcher

A configurable class offering a few different ways to perform text matching and replacing. Note the replaceAll property is only applicable where replacement is supported.

Notesโ€‹

A configurable class offering a few different ways to perform text matching and replacing. Note the replaceAll property is only applicable where replacement is supported.

Examplesโ€‹

basicโ€‹

The most basic form, performing an exact match on entire text. It will match "Paul", but not "paul", and not "I am Paul".

pattern: Paul

wildcardโ€‹

The following will successfully match this sentence: "It seems Paul and Marc are friends".

method: WILDCARD
ignoreCase: true
partial: true
pattern: paul*mar?

Usageโ€‹

Full configuration skeleton, with every option and its default
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false

Propertiesโ€‹

PropertyTypeRequiredDefault
ignoreCasebooleanNofalse
ignoreDiacriticbooleanNofalse
matchEmptybooleanNofalse
methodenumNoBASIC
negateMatchesbooleanNofalse
partialbooleanNofalse
patternstringNo-
replaceAllbooleanNofalse
trimbooleanNofalse

Property Detailsโ€‹

ignoreCaseโ€‹

When enabled, matching is performed without regard to character case.

ignoreDiacriticโ€‹

When enabled, diacritical marks (e.g., accents) are ignored when performing matching or replacing.

matchEmptyโ€‹

When enabled, null or empty strings are considered a positive match. To also treat blank (whitespace-only) values as matches, enable trim as well.

methodโ€‹

The matching method to use. Supported values are: BASIC (default, exact text match), CSV (comma-separated list of basic matches), WILDCARD (* matches any series of characters, ? matches any single character), and REGEX (Java-style regular expression matching).

Allowed Valuesโ€‹

  • BASIC
  • CSV
  • WILDCARD
  • REGEX

negateMatchesโ€‹

When enabled, the result of a match is inverted โ€” a pattern that would normally match will instead be treated as a non-match, and vice versa.

partialโ€‹

When enabled, the pattern only needs to match a portion of the text rather than the entire value. By default the full text must match.

patternโ€‹

The text or expression used for matching, whose interpretation depends on the selected method.

replaceAllโ€‹

When enabled, all occurrences of the pattern are replaced. When disabled, only the first occurrence is replaced. Only applicable when replacement is supported.

trimโ€‹

When enabled, leading and trailing whitespace is removed from the field value before processing.