replaceFirst
replaceFirst(text: String; replacement: String): String;
The replaceFirst method of the JadeRegexPattern class replaces only the first occurrence (if any) of the pattern in the specified text with the replacement text.
The following is an example of a replaceFirst operation with a customized pattern.
replaceFirstExample(); vars compiledPattern : JadeRegexPattern; begin create compiledPattern; compiledPattern.compile("\b([\w]+)\b"); write compiledPattern.replaceFirst("this is a string of text", "I'm"); // writes "I'm is a string of text" end;
This method returns the replacement string or it returns the original text if there is no successful match.
2020.0.01 and higher