I have an if statement in a script to see if a directory given via argparse is a UNC path. But does not end with a trailing slash.
import re
#dest is set by argparse. but for this purpose i'll set it manually.
#originally i was escaping each \ in dest. But I found that argparse left them alone.
dest = '\\server-name\folder\subfolder'
if re.match ('^\\+[\w\W]+', dest ) and not re.match( '^\\+[\w\W]+\\$', dest):
dest = dest + '\\'
I've been playing with this in ipython. The first statement is failing to match. I used the RxToolkit in Komodo IDE, it shows the regex as matching. I tried this webtool: http://www.pythonregex.com/ it matches as well. Any ideas?