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
104 stars 36 forks source link

Simply doesn't work #289

Open lukepighetti opened 2 years ago

lukepighetti commented 2 years ago

Hello, I tried to use this to extract 1.0.0 from refs/heads/release/1.0.0, but failed.

jobs:
  deploy:
    name: Deploy to TestFlight
    runs-on: macos-latest
    timeout-minutes: 60

    steps:
      - uses: actions-ecosystem/action-regex-match@v2
        id: branch-version-regex
        with:
          text: "${{ github.ref }}"
          regex: '\d+\.\d+\.\d+$'

      - run: echo '${{ github.ref }}'
      - run: echo '${{ steps.branch-version-regex.outputs.group1 }}'

This outputs

This regex was crafted with https://regex101.com in JavaScript mode

kaisugi commented 2 years ago

seems duplicated to https://github.com/actions-ecosystem/action-regex-match/issues/158 use .+? instead of \d+

ayushishah-easternts commented 2 years ago

/<a [^>]\bhref\s=\s"([^"]vercel.app[^"]*)/

This is not working for me @kaisugi @lukepighetti

lukepighetti commented 2 years ago

seems duplicated to #158 use .+? instead of \d+

. and \d are not the same delimiters

jtmuller5 commented 1 year ago

It seems like the issue is that group1 can be empty while match contains a value. I used this code to extract the version name from a git tag (v1.5.5+157):

- name: 'Extract version name from tag'
        uses: actions-ecosystem/action-regex-match@v2
        id: version-name
        with:
          text: ${{ env.VERSION_NAME }}
          regex: '[0-9]+\.[0-9]+\.[0-9]+' # https://regexr.com/

When I printed out the results, group1 is blank and match contained the correct value (1.5.5):

 - name: 'Print extracted values'
        run: |
          echo ${{ steps.version-name.outputs.group1 }} // ''
          echo ${{ steps.version-name.outputs.match }} // '1.5.5'