Instead of writing stuff I decided to chicken out and talk.
Anyways, Windows paths use \ as the path separator. You might see it as
horrible (it is), but for globbing it is actually fine since ? and * are
disallowed in filenames. You will still need to escape [ and the extglob
(, but recall that | is disallowed too so you can just use that as the
escape character.
You may or may not need to have a compile step to convert this glob into actual
glob(7). For that you just replace all instances of \ with /, and all
instances of | with \. The drivename handling will depend on the
environment at hand; for Cygwin-based systems, you have:
(\\\\\?\)^([A-Z]):becomes/proc/cygdrive/$2^\\\\:becomes//
This replacement with cygdrive will inflate the string size and make it
impossible to do it in-place, so I recommend not doing it if possible.
why am I going thru my own gists?
well. I've got the code written out at https://cygwin.com/pipermail/cygwin-patches/2021q2/011367.html. I got lost in code review as one always do. there might even be a Cygwin GitHub PR I'm too ashamed to link to, which contains more mentions to this stuff.