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

Add operator for REGEX matching in context #226

Closed
lukaszachy opened this issue Mar 7, 2024 · 2 comments · Fixed by #272
Closed

Add operator for REGEX matching in context #226

lukaszachy opened this issue Mar 7, 2024 · 2 comments · Fixed by #272
Assignees
Labels
context enhancement New feature or request
Milestone

Comments

@lukaszachy
Copy link
Collaborator

Add two operators:
~ for match
!~ for not match

Note we have ~= and similar for "major version" comparison.
However since ~ is used in tmt hardware it make sense to use such symbol here as well

@lukaszachy lukaszachy added enhancement New feature or request context labels Mar 7, 2024
@LecrisUT
Copy link
Contributor

LecrisUT commented Mar 9, 2024

Let me add to this, the regex matches should be exposed as context objects:

  • by default all regex matches should be stored under a regex_match context
  • for clarity, the regex should only be allowed to match once so regex_match is singular valued
  • regex match groups are stored as the dictionary of regex_match
    • always save the matches by their group int keys
    • if the group is named, include the str key-values
    • there is always the match group 0 that is the full regex match

This could be particularly useful in combination with #227

@psss psss added this to the 1.6 milestone Dec 12, 2024
@psss psss self-assigned this Jan 6, 2025
psss added a commit that referenced this issue Jan 6, 2025
Support new operator `~` for matching patterns and `!~` for
negative matching patterns in the context rules.

Fix #226.
@psss
Copy link
Collaborator

psss commented Jan 6, 2025

The regex_match sounds like a useful feature. But it will need some discussion as for now the dimension values can only be list of strings, not dictionaries. Let's start small. I've implemented the basic support for the regular expression matching in #272. We can extend the functionality later.

@psss psss closed this as completed in #272 Jan 7, 2025
psss added a commit that referenced this issue Jan 7, 2025
Support new operator `~` for matching patterns and `!~` for
negative matching patterns in the context rules.

Fix #226.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants