fmf icon indicating copy to clipboard operation
fmf copied to clipboard

Add operator for REGEX matching in context

Open lukaszachy opened this issue 11 months ago • 1 comments

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 avatar Mar 07 '24 16:03 lukaszachy

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

LecrisUT avatar Mar 09 '24 06:03 LecrisUT

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 avatar Jan 06 '25 15:01 psss