Link Search Menu Expand Document

RegexMatcher.ReplaceFirst Method

Explanation Replaces the first part that matches the regular expression pattern with the specified string.
Call format var s = rm.ReplaceFirst( replacement )
Return value Replaced result string
From Ver.5.0.1, UString type string is returned in Unicode mode.
Arguments String replacement Replacement string
You can use a reference to a forward reference group by "$n"
From Ver.5.0.1, it is treated as UString type in Unicode mode.
Exception Func 14 The value cannot be referenced
Example of use
var p = RegexPattern.Compile("Biz/([a-zA-Z]+)");
var m = p.Matcher("Biz/Browser, Biz/Designer");
print(m.ReplaceFirst("ABC Biz/$1"), "\n");
    
Related item ReplaceAll method