我正在尝试从字符串中获取一段文本。我正在尝试使用:
def findPersonInfo(self):
if (self.isPerson == True):
regex = re.compile("\{\{persondata(.*)\}\}",re.IGNORECASE|re.MULTILINE|re.UNICODE)
result = regex.search(self._rawPage)
if result:
print 'Match found: ', result.group()
字符串是:(是的,它是一个 wiki 页面)
*[http://www.jsc.nasa.gov/Bios/htmlbios/acaba-jm.html NASA biography]
{{NASA Astronaut Group 19}}
{{Persondata
|NAME= Acaba, Joseph Michael "Joe"
|ALTERNATIVE NAMES=
|SHORT DESCRIPTION=[[Hydrogeologist]]
|DATE OF BIRTH={{Birth date and age|1967|5|17}}
|PLACE OF BIRTH=[[Inglewood, California]]
|DATE OF DEATH=
|PLACE OF DEATH=
}}
{{DEFAULTSORT:Acaba, Joseph M.}}
[[Category:1967 births]]
但我一直没有匹配。