Skip to content

Commit cc5c133

Browse files
Fix the reviewed comments
1 parent 3cdef73 commit cc5c133

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

docs/proposals/extract_substring.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ _Issues_: [#2689](https://github.com/ballerina-platform/ballerina-standard-libra
1010
The Ballerina Regex module doesn't have any API to extract a substring/s from the given string by using regex. So, this proposal introduces new APIs to extract a substring/s from the given string using regex.
1111

1212
## Goals
13-
14-
- Provide a way to extract a substring/s using regex.
13+
Provide a way to extract a substring/s using regex.
1514

1615
## Motivation
1716
As mentioned in the summary, at the moment, users have no way to extract a substring/s from the given string. But this is an important feature in string manipulation. So, this allows users to extract a substring/s easily by using Ballerina.
@@ -30,6 +29,7 @@ int startIndex;
3029
int endIndex;
3130
|};
3231
```
32+
3333
```ballerina
3434
# Holds information about matched regex groups
3535
public type Groups readonly & object {

docs/proposals/update_replace_functions.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,21 @@ _Issues_: [#2772](https://github.com/ballerina-platform/ballerina-standard-libra
1010
The existing replacement functions don't support the following functionalities:
1111
- There is no way to replace the matches from the particular string index of the given string.
1212
- There isn't any mechanism to replace the matches with a dynamic value.
13-
1413
So, this proposal improves the replacement functions to support the above functionalities.
1514

1615
## Goals
17-
18-
- Provide a way to support the above functionalities.
16+
Provide a way to support the above functionalities.
1917

2018
## Motivation
21-
2219
This allows users to get the above functionalities when using replacement functions.
2320

2421
## Description
25-
2622
API improvements are:
2723

2824
- Introduce a function to create the new substring to be used to replace the matches.
2925
```ballerina
3026
# A function to be invoked to create the new substring to be used to replace the matches.
31-
type ReplacerFunction function(Match 'match) returns string;
27+
type ReplacerFunction function(Match matched) returns string;
3228
```
3329
3430
- Introduce a new type to get the replacement value.
@@ -37,7 +33,7 @@ API improvements are:
3733
public type Replacement ReplacerFunction|string;
3834
```
3935
40-
- Change the 3rd param of the API with a new type.
36+
- Change the type of replacement param from string to `Replacement` type.
4137
```ballerina
4238
# Replaces each occurrence of the substrings, which match the provided
4339
# regex from the given original string value with the
@@ -55,7 +51,7 @@ API improvements are:
5551
public isolated function replaceAll(string originalString, string regex, Replacement replacement) returns string;
5652
```
5753
58-
- Change the 3rd param of the API with a new type and introduce a new param `startIndex`.
54+
- Change the type of replacement param from string to `Replacement` type and introduce a new param `startIndex`.
5955
```ballerina
6056
# Replaces the first substring that matches the given regex with
6157
# the provided replacement string or function.

0 commit comments

Comments
 (0)