go regex parsing string to environment variable -


i have string trying parse using go regexp , convert os.getenv(env). assuming have string "hello world -p $path -f $hostname " in go, , want use regexp read os.getenv("path") , os.getenv("hostname"). can me proper regexp parser extract out "$" along word pass through os.getenv() parameter getting environment variable?

the os.expandenv function replaces $var or ${var} in string according values in environment. recommend using function instead of writing own using regular expressions.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -