You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is useful in case the string to use as replacement contains leading
or trailing whitespace. This should function as a workaround for #6.
Thanks to @Simran-B for the suggestion!
Flags to use when matching. Please refer to [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) for more information.
22
-
23
-
## Outputs
24
-
25
-
### `replaced`
26
-
27
-
The replaced string.
28
-
29
-
## Example usage
30
-
31
-
```yaml
32
-
uses: frabert/replace-string-action@v1.2
33
-
with:
34
-
pattern: 'Hello, (\w+)!'
35
-
string: 'Hello, world!'
36
-
replace-with: 'I greet you, $1!'
37
-
```
1
+
# `replace-string` GitHub Action
2
+
3
+
Replaces strings with regular expressions.
4
+
5
+
## Inputs
6
+
7
+
### `pattern`
8
+
9
+
**Required** Regular expression to match.
10
+
11
+
### `string`
12
+
13
+
**Required** Input string.
14
+
15
+
### `replace-with`
16
+
17
+
**Required** String to use for replacement.
18
+
19
+
### `flags`
20
+
21
+
Flags to use when matching. Please refer to [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) for more information.
22
+
23
+
### `json`
24
+
25
+
Boolean. Interprets `replace-with` as JSON data. Useful for when `replace-with` contains leading or trailing whitespace that would be trimmed away by GitHub.
description: 'Use regular expressions to manipulate strings'
4
-
inputs:
5
-
pattern:
6
-
description: 'Regular expression pattern'
7
-
required: true
8
-
string:
9
-
description: 'The input string'
10
-
required: true
11
-
replace-with:
12
-
description: 'What to replace with'
13
-
required: true
14
-
flags:
15
-
description: 'Flags to use when matching'
16
-
required: false
17
-
outputs:
18
-
replaced:
19
-
description: 'The output string'
20
-
runs:
21
-
using: 'node12'
22
-
main: 'index.js'
23
-
branding:
24
-
icon: 'search'
1
+
name: 'Replace string'
2
+
author: 'Francesco Bertolaccini'
3
+
description: 'Use regular expressions to manipulate strings'
4
+
inputs:
5
+
pattern:
6
+
description: 'Regular expression pattern'
7
+
required: true
8
+
string:
9
+
description: 'The input string'
10
+
required: true
11
+
replace-with:
12
+
description: 'What to replace with'
13
+
required: true
14
+
flags:
15
+
description: 'Flags to use when matching'
16
+
required: false
17
+
json:
18
+
description: 'Interprets `replace-with` as JSON data. Useful for when `replace-with` contains leading or trailing whitespace that would be trimmed away by GitHub'
0 commit comments