Entity/glance card convert string to icon?

I have an ecowitt weather station that gives me UV index data, however it is presented as a string:

"5 UV index" for example.

I'd like to create an entity/card which simply has the number shown as an icon:

I'd like to truncate the string from "5 UV index" to just 5, and ideally it would be nice for the icon to change to represent that number too - possibly even with colours to match intensity.

this is the YAML for the card currently:

show_name: false
show_icon: true
show_state: true
type: glance
entities:
  - entity: sensor.gw2000a_outdoor_temperature
    name: temperature
  - entity: sensor.gw2000a_humidity
    name: humidity
  - entity: sensor.gw2000a_wind_speed
    name: wind
  - entity: sensor.gw2000a_wind_direction
    name: direcition
  - entity: sensor.gw2000a_rain_rate_piezo
    name: Rain
  - entity: sensor.gw2000a_uv_index
    icon: mdi:weather-sunny-alert
    name: UV Index
    show_state: true
    show_last_changed: false
state_color: true
columns: 6

in the future I may want to separate the UV index into its' own card, but for a quick compact summary the above is adequate.

Any suggestions anyone?

{{ '5 UV index' | regex_replace('^([0-9]*).*$', '\\1') }} -> 5

You can make it a template sensor.