You can lookup here how to manipulate strings in bash: https://tldp.org/LDP/abs/html/string-manipulation.html
And by utilizing expr
you can do regular expressions:
#!/bin/bash
# Various irrelevant stuff
https_proxy="http://username:password@proxy-host:port"
proxy_user=`expr $https_proxy : '.*\/\([^:]*\)'`
proxy_pw=`expr $https_proxy : '.*\:\(.*\)@'`
echo $proxy_user
echo $proxy_pw