This GitHub action matches a string against a regex pattern and outputs its capture groups, if any.
Required The regex pattern to test with. (e.g. "^Hello (.*)$")
Optional The regex flags (e.g. "gi")
Required The string to test against (e.g. "Hello World")
The (n-1)th capture group of the string matched against the regex pattern. (e.g. "World")
- name: Who to greet?
id: who_to_greet
uses: michielkempen/regex-matcher@v1
with:
regex_pattern: '^Hello (.*)$'
search_string: 'Hello World'
- name: Greeting
run: echo "Hello ${{ steps.who_to_greet.outputs.match_0 }}"