@@ -38,14 +38,14 @@ public isolated function matches(string stringToMatch, string regex) returns boo
3838# + originalString - The original string to replace the first occurrence of the
3939# substring that matches the provided regex
4040# + regex - The regex to match the first substring in the `originalString` to be replaced
41- # + replacement - The replacement string or A function to be invoked to create the new substring to be
41+ # + replacement - The replacement string or a function to be invoked to create the new substring to be
4242# used to replace the first match to the given regex
4343# + startIndex - The starting index for the search
4444# + return - The resultant string with the replaced substring
4545public isolated function replace(string originalString , string regex , Replacement replacement ,
4646 int startIndex = 0 ) returns string {
4747 Match ? matched = search (originalString , regex , startIndex );
48- if matched is null {
48+ if matched is () {
4949 return originalString ;
5050 }
5151 int index = 0 ;
@@ -159,7 +159,7 @@ public isolated function search(string str, string regex, int startIndex = 0) re
159159 return matched ;
160160 }
161161 }
162- return null ;
162+ return () ;
163163}
164164
165165# Returns all substrings in string that match the regex.
@@ -185,8 +185,7 @@ public isolated function searchAll(string str, string regex) returns Match[] {
185185 startIndex : startIndex ,
186186 endIndex : getEndIndex (matcher ),
187187 groups : new MatchGroups (matcher , startIndex , regex , valueInString )
188- }
189- );
188+ });
190189 }
191190 }
192191 return matched ;
0 commit comments