Это выражение, вероятно, может работать здесь:
OnUploadCompleted\([0-9]+\s*,\s*\"\/(.+?)\"
, и наш желаемый результат находится в этой группе захвата (.+?)
.
Пожалуйста, ознакомьтесь с демонстрацией для получения дополнительных пояснений.
Тест
import re
regex = r"OnUploadCompleted\([0-9]+\s*,\s*\"\/(.+?)\""
test_str = ("<script type=\"text/javascript\">\n"
"(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e)\n"
" {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();\n"
"window.parent.OnUploadCompleted(0,\"/userfiles/abc.txt\",\"abc.txt\", \"\") ;</script>")
matches = re.finditer(regex, test_str, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))