Customize

Replace Strings with Specified Regular Expressions

Summary

Replace parts that match the regular expression with another string based on the field value.

How to use

Parameters

Set Filed, Regular Expression, Replace String, and How Handle Multiple Hits.

Field

Select the fields to replace. You can select multiple fields. When multiple fields are selected. the Action will simultaneously replace the target string in all fields.

This parameter accepts the following field types:

  • Text
  • Text area
  • Rich text
  • Link

If you select a field that is inside a table, the Do will process all rows of that table. See *1 for exceptions to this behavior.

*1: If you set a Condition that only applies to some table rows (such as the Condition “When Fields Value Changed”), the value will be set only for those affected by that Condition.

Regular Expression

Enter regular expression.

Example

(\d+)-(\d+)-(\d+)

Replace String

Enter the string to replace the matched part. If this parameter is left empty, the string preceding the replacement will be removed during substitution.

You can replace parts of a matched string captured by parentheses in regular expressions using $1, $2, and so on. However, be careful not to confuse $1 with the results of other actions when using Customine’s formula function.

Example 1: To replace parts that match within parentheses in the regular expression (note that this is not an expression, so it does not start with “="):

$1 year $2 month $3 day

Example 2: To replace values with the results of other actions (when using a Customine expression, remember to start with “="):

=$1

How to Handle Multiple Hits

If the target field contains multiple matched segments, you can choose to proceed by selecting either “Replace All” or “Replace Only First One.”

Select “Replace All” to replace every instance of the target. Select “Replace Only First One” to replace just the first instance of the target closest to the beginning of the field value.

Compatibility with krewSheet

This action is designed to work seamlessly with krewSheet.

Fields retrieved through a Lookup are not supported.

The following field types can be supported only at the timing of record saving (e.g. “Before Record Saved Excluding Deleted”): If you want to gain more technical knowledge, refer to the krewSheet documentation .

  • Fields not included in the krewSheet view’s columns
  • Fields set to read-only in krewSheet
  • Rich text field

Differences compared to the old version:

There are changes in operation in Customine version 1.161 (released on February 10, 2022). To maintain compatibility, versions prior to 1.160 (released on January 27, 2022) can continue to be used under the name “Replace field values using regular expressions (old).” The differences in operation between the old and new versions are as follows:

  • The regular expression metacharacters ‘^’ and ‘$’ handling differs between versions.
    • In versions before 1.160: ‘^’ matches only at the very beginning of a sentence, while ‘$’ matches only at the very end, meaning they do not match at the start or end of the line.
    • Starting from version 1.161: ‘^’ matches the beginning of a line and the start of the string, and ‘$’ matches the end of a line and the end of the sentence, allowing for multiline mode.

Restrictions

  • Regular expression matching and replacement processing uses the standard RegExp of JavaScript. Therefore, the detailed behavior of regular expressions, such as available special characters, depends on the RegExp implementation of the web browser.