PhixFlow Help

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Function: replaceFirst()

Replace the first occurrence of a pattern with a replacement string.

Syntax

replaceFirst(listToCheck, findPattern, replacementString)

Argument Type Description
listToCheck Array List of strings to evaluate
findPattern Regular Expression Pattern to be matched in listToCheck
replacementString String String to replace matching pattern in list

Examples

replaceFirst(in.fileName, "[0-9]{8}", "")

replaceFirst() removes the first string of 8 digits from file names contained in the attribute in.fileName.

If in.fileName = "20060712file-proc20070103-1263", this returns "file-proc20070103-1263".

replaceFirst(in.fileName, "file_([0-9A-Za-z]+)\\.txt", "$1")

replaceFirst() matches alphanumeric characters between "file_" and ".txt", and replaces the whole string with this value, if a match is made. In this way, a part or parts of the input string can be extracted. If in.fileName = "file_teamA.txt", the result of this expression will be "teamA".

See Also

  • No labels