actions-ecosystem / action-regex-match

🔍 GitHub Action to do regex matching
https://github.com/marketplace/actions/actions-ecosystem-action-regex-match
Apache License 2.0
107 stars 36 forks source link

problem for multiple matches #230

Open LouisCoilliot opened 3 years ago

LouisCoilliot commented 3 years ago

What happened

Using :

      - uses: actions-ecosystem/action-regex-match@v2.0.2
        id: regex-match
        with:
          text: "${{ steps.changed-files.outputs.all_modified_files }}"
          regex: 'inventory\/(.*?)\/'
          # all matches, not just first one
          flags: gm
      - name: debug steps.regex-match.outputs
        run: echo "$DBG"
        env:
          DBG: ${{ toJson(steps.regex-match.outputs) }}

The search being (from the job logs):

Run actions-ecosystem/action-regex-match@v2.0.2
  with:
    text: inventory/usglb-dev1/inventory.ini,inventory/usglb-dev2/inventory.ini
    regex: inventory\/(.*?)\/
    flags: gm

What you expected to happen

It should match 'usglb-dev1' AND 'usglb-dev2'

It only matches :

Run echo "$DBG"
{
  "match": "inventory/usglb-dev1/",
  "group1": "usglb-dev1"
}

I checked the regex, see image in attachment.

regex-test

Regards,

Louis

Louis

LouisCoilliot commented 3 years ago

Instead of

{
  "match": "inventory/usglb-dev1/",
  "group1": "usglb-dev1"
}

I would expect something like :

[
  {
    "match": "inventory/usglb-dev1/",
    "group1": "usglb-dev1"
  },
  {
    "match": "inventory/usglb-dev2/",
    "group1": "usglb-dev2"
  }
]

Maybe this issue should be relabeled as feature enhancement.

Louis