A simple action that looks for multiple regex matches, in a input text, and returns the key of the first found match.
Add the step to your github action yml
steps:
- name: Manual Action Test
id: match
uses: ChristofferDahlen/Multi-Regex-Match@v1
with:
input: "This is the test string. It contains cats "
json_match: '{ "(?i)(dog|cat)" : "animal", "(?i)(volvo|BMW)" : "(volvo|BMW)"}' # Imbedded json
The output can then be acessed as ${{ steps.match.outputs.result }}
Input | Description | Required |
---|---|---|
json_match |
A json string containing a key-value pairs. The key is the regex expression used for matching (go flavor). The value is the returned output if it has been sucessfully matched. It returns only the first match. | yes |
input |
The input string that is used to match against | yes |
Ouput | Description |
---|---|
result |
The value (of the key value pair) of the first found match |
The regex is in the golang dialect
{
"Regexp 1" : "outValue",
"Regexp 2" : "outValue",
...
}