RegEx using capture group variable

Hi I would like to know if we can use capture group from RegEx used by rules for a workflow.

For example: try to use the capture group to check the major version using $1 as shown below

myjob:
   rules:
     -if: $VERSION =~ /^(\d+)\./ && $1 >= 42

I cannot find documentation or example showing such an option to use the capture group from the RegExp.

Thanks