Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use regex group match and use matched group name label? #171

Open
sunkaifang opened this issue Dec 22, 2021 · 1 comment
Open

how to use regex group match and use matched group name label? #171

sunkaifang opened this issue Dec 22, 2021 · 1 comment

Comments

@sunkaifang
Copy link

such as ,I have group match: (A).(B).(C), could I generate label named with : A-C? no use B.
now, I found that ,the label is named:(A).(B).(C). can't get rid of B.
what need I do?
thx a lot.

@jburgess
Copy link

jburgess commented Jan 6, 2022

@sunkaifang You can use gsub with a capture group. Example:

labelName: '{{gsub .paramName "^(.*)\.(.*)\.(.*)$" "\\1-\\3"}}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants