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

jpa - Passing entitymanager from reflection method -

frame rate - JAVA simple fps animation(how can i work with?) -