|this technique of using the : and the expression is that called something that I can go read about?|
You can find more info by going to the command line and typing in "set /?". There is also quite a lot of other info included.
what's the : actually do here and it the stuff on the right of the colon just a regex like I would use in grep?
The ":" is presumably just a marker to tell cmd that extended variable expansion is being used. It is also used for substrings in combination with "~".
Not really regex, it's just a very simple string replace function, it doesn't do any real regex.
The replacement can be blank to delete the string.
It does have one little extra trick though:
This will remove all characters from the start of the variable up to and including "string", but will not replace occurrences of "string" thereafter. It would seem logical that the use of the wild card would work in additional ways, but it doesn't.
There are also a couple of bugs.
"string" cannot contain the character "=", although "replacement" can. This is because the first "=" is used to delimit "string" and "replacement".
Due to the use of the asterisk as a wild card and a tilde to denote substrings, "string" cannot be a literal string that starts with either "*" or "~".
Although cmd has an escape character("^"), it doesn't fix these problems.