Versions Compared

Key

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


This routine is available starting with SIL Engine™ 4.8.0.13.
Info
titleAvailability
Table plus
applyColStyleToCelltrue
heading0
columnTypess,s,s,s
multiplefalse
columnAttributesstyle="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold,
enableSortingfalse

Syntax

matchReplace(source, target, replacement);

Package

Alias

Pkg Usage

Description

Excerpt
hiddentrue
Uses a regex expression to find and replace text within a string.

Uses a regex expression to find and replace text within a string.

Parameters

Table plus
applyColStyleToCelltrue
columnTypess,s,s,s
heading0
multiplefalse
enableSortingfalse

Parameter name

Type

Required

Description

...

source

String

Yes

Text string to be updated.

...

target

String

Yes

Regex expression used to target text for replacement.

...

replacement

String

Yes

Replacement text used to update the target text found by the regex expression.

Return

...

Type

String

Examples

Example 1

Code Block
string sourceText = "Oh, you are a Nigerian prince? Here is my credit card number 1111-2222-3333-4444.";

matchReplace(sourceText, "\d{4}-?\d{4}-?\d{4}-?\d{4}", "XXXX-XXXX-XXXX-XXXX");

Returns:   "Oh, you are a Nigerian prince? Here is my credit card number XXXX-XXXX-XXXX-XXXX."

Example 2

...

Code Block
string HTML = "<p>Geckos are a group of usually small, usually <strong style='color: blue;'>nocturnal</strong> lizards. They are found on every continent except Australia.</p>";
      

    
return matchReplace(HTML, "<[^>]*>", "");

...

Filter by label (Content by label)
showLabelsfalse
max25
showSpacefalse
cqllabel = "jirastring_group_routine" and space = currentSpace ( )
labelsjiraarray_group_routineroutines