Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

replaceAll(listToCheck, findPattern, replacementString)

ArgumentTypeDescription
listToCheckString or Array A string (or list of strings) to evaluate.
findPatternRegular
Expression
ExpressionsPattern to be matched in listToCheck
replacementStringStringString to replace matching pattern in list

 replaceAll applied to:

  • a multielement array returns a multielement array
  • a single element array returns a string.

Examples

Code Block
replaceAll(in.fileName, "[0-9]{8}", "")

replaceAll() This expression removes all strings of 8 digits from file names contained in the attribute in.fileName.

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



Code Block
replaceAll(in.BudgetCode,"\\\\","")

This expression removes any backslashes ("\") in the string "in.BudgetCode", e.g. if in.BudgetCode is "323\-ABC", the value returned is "323-ABC".

The reason that multiple backslashes are used is because "\" is an "escape" character in a Regular ExpressionExpressions. This allows special control charaters characters to be treated as regular characters. See Regular ExpressionExpressions for more details. 



Code Block
replaceAll(in.TITLE,"[^{Space}0-9A-Za-z]","")

This expression removes all characters, except spaces, numbers and letters, from the attribute in.TITLE.



Code Block
replaceAll(in.TITLE,"[^{Space}A-Za-z]","")

This expression removes all characters, except spaces and letters, from the attribute in.TITLE.



Code Block
replaceAll(JSON Code,"[^\\p{Space}0-9A-Za-z!:\\\"%&\\[*()\\],-/_\\\\{}\\.]","")

This expression removes all non-standard characters which are not accepted by JSON format, such as whitespace characters, emojis and Japanese Kanji.

See Also