FME Transformers: 2024.2

Categories
Strings
Related Transformers
StringPairReplacer
StringSearcher

StringReplacer

Replaces substrings matching a string or regular expression in the string contained in the source attribute.  

Examples

In this example, a pure substitution of text is made without any use of regular expression functionality. This is the simplest kind of substring replacement.

   Source String: Bobby

   Text to Find: obb

   Replacement Text: ill

   Use Regular Expression: no

   Case Sensitive: yes

   Result: Billy

In this example, a pattern matching zero or more ’b’ characters is replaced with nothing.

   Source String: Bobby

   Text to Find: b*

   Replacement Text:

   Use Regular Expression: yes

   Case Sensitive: yes

   Result: Boy

In this example, a pattern matching zero or more ’b’ characters followed by a y is duplicated in the result (prepended by hyphens)

   Source String: Bobby

   Text to Find: (b*y)

   Replacement Text: --\1-\1

   Use Regular Expression: yes

   Case Sensitive: yes

   Result: Bo--bby-bby

Usage Notes

Configuration

Parameters

Editing Transformer Parameters

Transformer parameters can be set by directly entering values, using expressions, or referencing other elements in the workspace such as attribute values or user parameters. Various editors and context menus are available to assist. To see what is available, click beside the applicable parameter.

For more information, see Transformer Parameter Menu Options.

FME Community

The FME Community has a wealth of FME knowledge with over 20,000 active members worldwide. Get help with FME, share knowledge, and connect with users globally.

Search for all results about the StringReplacer on the FME Community.