Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Are you simply talking about replacing the space with an underscore, in the field names? I'm having a bit of a hard time understanding "Pattern 1" vs "Pattern 2". In any case, see here for information about replacing characters in field names.

Are you simply talking about replacing the space with an underscore, in the field names? I'm having a bit of a hard time understanding "Pattern 1" vs "Pattern 2". In any case, see here for information about replacing characters in field names.

Update: given your requirements as stated in the comments.

First scenario can be handled by a Field Mapper Processor with the following configs (will match any two digits at the beginning of a field name, tweak as needed).

  • Operate On: Field Names
  • Conditional Expression: ${str:matches(f:name(), "^[0-9]{2}.*")}
  • Mapping Expression: ${str:replaceAll(f:name(), "^([0-9]{2})(.*)", "_$1_$2")}

The second scenario can also be handled by the Field Mapper Processor. This one is simpler (only looks for _) but that can obviously be tweaked as well if you need more complexity (eg: using a regex instead).

  • Operate On: Field Names
  • Conditional Expression: ${str:endsWith(f:name(), "_")}
  • Mapping Expression: ${str:substring(f:name(), 0, str:length(f:name()) - 1)}