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

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -