I am trying to get all the test case list from a file. Eg. void DTC_SetHighBitRate_001()
.
re.findall("void S?[DS]TC_.+\(\)", testCaseFile)
But now, few test cases are modified like this,
void DTC_SetHighBitRate_001(void)
void DTC_SetHighBitRate_001(Void)
I tried to use regular expression like this:
re.findall("void S?[DS]TC_.+\([vV]oid)*(\)", testCaseFile)
But this did not work. I want to allow ONLY 'void'
or 'Void'
inside the brackets. How can i do that?
EDIT: Sorry to mention that, even if 'void' is not present, it should allow.
Let me give you an improved version :
re.findall("void S?[DS]TC_.+\([vV]oid\)", testCaseFile)
This will find only the occurrences with void (notice the *
removed)
re.findall("void S?[DS]TC_.+\(([vV]oid)?\)", testCaseFile)
This will find all the cases: just empty parentheses and with void
.
如果只想获得...(void)或...(Void)术语,请尝试此
re.findall("void S?[DS]TC_.+\([vV]oid]*\)", testCaseFile)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.