replaceAll
replaceAll(text: String; replacements: String; pattern: String; ignoreCase: Boolean): String;
The replaceAll method of the JadeRegex class replaces all occurrences of the specified pattern in the specified text with the replacement text. This method returns the replacement string or the original text if there is no successful match.
The replaceAll method parameters are described in the following table.
Parameter | Description |
---|---|
text | Text string within which you want to replace text |
replacements |
Text with which to replace matches |
pattern | Regex pattern string |
ignoreCase | Specifies whether matching is case-sensitive |
The following is an example of a replaceAll type method for quick, simple use of the JadeRegexLibrary.
typeReplaceAll(); vars text, pattern, replacement : String; begin text := "https://www.jadeworld.com/"; pattern := "http[s]?:\/\/\S+"; replacement := '<a href="$0">$0</a>'; write JadeRegex@replaceAll(text, replacement, pattern, true); // writes <a href="https://www.jadeworld.com/">https://www.jadeworld.com/</a> end;
2020.0.01 and higher