SBM ModScript Reference → Programming SBM ModScript → Object Types → Regex → Regex ReplaceAll() Method
Replaces all matched parts of a string with a replacement value using the compiled regex.
Parameter | Type | Description |
---|---|---|
value |
string |
The string to be searched. |
replacement |
string |
The value inserted into the string in the matched locations. |
Type | Description |
---|---|
string |
A string where all matches for the compiled Regex in "value" are replaced with "replacement". |
SBM ModScript version: 11.3.
var r = Regex(); // Regex object 'r' r.Compile("\\d+"); // Compile regex expression "\d+" var changed = r.ReplaceAll("12ab3d456e78", "ABC"); // Replace each group of digits in the first string "value" with the replacement string Ext.WriteStream( changed );
Result:
ABCabABCdABCeABC
None.
Copyright © 2007–2019 Micro Focus or one of its affiliates. All rights reserved.