Can't use some CI vars in rules

I opened an issue on gitlab about using some CI vars in rules.

It was closed with the comment:

Closing since it’s not an issues. Please refer to how to use variables in regex or contact our support for technical help.

I didn’t find a documentation telling how to use variables in regex, besides a somewhat unrelated issue about regex stored inside a variable.

Is it possible to use variables in regular expressions, and how should I?

After more testing, I guess I’m blocked by 2 problems:

  • using a var inside a regex (job1 in my test repo)
  • or using a regex stored in a var (job1c)