Custom predefined variable for environment

Hello. I want to use custom variable for environment config. This variable is just a regexp from existing predefined $CI_ENVIRONMENT_NAME. Now I escape it with runner like:

deploy:
  script:
    # just regexp to escape jira ticket id from /feature/DO-100-branch and lower case it to do-100
    - export ENV=`echo $CI_ENVIRONMENT_NAME | grep -e grep -e '[A-Z]\+-[0-9]\+' -o | sort -u | awk '{print tolower($0)}'`" 
  environment:
    name: $CI_BUILD_REF_NAME
    url: http://$CI_BUILD_REF_SLUG.example.com

So is it possible to use $ENV for environment url insted of $CI_BUILD_REF_NAME ?