#!/p4/common/python/bin/python3
import re
pathArgList = ['...', '//foo/...@300', 'bogus', '/my/home/...#none', 'homedir', '...@3L', 'good/...', 'bad/..', '#have']
print ("\nS1: ...@")
for pathArg in pathArgList:
if (re.search ('\.\.\.@', pathArg)):
print ("MATCH : %s" % pathArg)
else:
print ("NO MATCH: %s" % pathArg)
print ("\nS2: ...#")
for pathArg in pathArgList:
if (re.search('\.\.\.#', pathArg)):
print ("MATCH : %s" % pathArg)
else:
print ("NO MATCH: %s" % pathArg)
print ("\nS3: ...$")
for pathArg in pathArgList:
if (re.search('\.\.\.$', pathArg)):
print ("MATCH : %s" % pathArg)
else:
print ("NO MATCH: %s" % pathArg)
print ("\nS4: Combined Search ...@|# or ...")
for pathArg in pathArgList:
if (re.search ('\.\.\.(@|#)', pathArg) or re.search('\.\.\.$', pathArg)):
print ("MATCH : %s" % pathArg)
else:
print ("NO MATCH: %s" % pathArg)
print ("\nS5: Finding revSpecPart")
for anArg in pathArgList:
revSpecPart = ''
if r'@' in anArg:
revSpecPart = re.sub ('^.*@', '@', anArg)
if r'#' in anArg:
revSpecPart = re.sub ('^.*#', '#', anArg)
print ("Rev Spec Part of [%s] is [%s]." % (anArg, revSpecPart))