'How to use slash for =~ in Gitlab-ci

I've use Tag($CI_COMMIT_TAG) to controll the event.
I need to let Tag partially similar with my Tag name.
Here is my yml
My Commit_Tag usually like feature/dev/helloworld...
How can i use slash in regex operator ?
thanks

build_dev_job:
  stage: build
  only:
    variables:
      - '$CI_COMMIT_TAG =~ /^feature/dev_*/'
  script: 
    - export VERSION=$(date +%y.%m.%d)
    - docker build -t my_dotnet_app:$VERSION -f ./Dockerfile .
  tags:
    - core-runner


Solution 1:[1]

GitLab uses re2 syntax.

To escape any characters as a literal, prefix it with \

/^feature\/dev_*/

Do keep in mind that you need to be mindful of YAML syntax and that your text is not interpreted as an escape sequence in your YAML.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sytech