我有一个如下所示的文本格式,我需要使用正则表达式提取文本,对于每个键,我都有一个3digit数字,这可能有助于提取文本。我也能够使用该逻辑提取文本。请帮助我从下面的其他行获取值,直到我得到下一个数字或:符号
示例文本文档
200 Testresults:
Negative - blood sample shows a negative result
200 study: lung issues
Disease code: 1#0045252452
200 Comments:
Results should be tezted for the confirmation of Covid-19 with the assigned physican
samples have been attached in the report
200 Date: 02/05/2020
RE:示例代码
newtext = re.compile(r'^\d{3} [a-z].*')
必需的Json
{"Testresults":"Negative - blood sample shows a negative result ","study":"lung issues","Comments":"Results should be tezted for the confirmation of Covid-19 with the assigned physican samples have been attached in the report","Date":"02/05/2020"}
以下内容将为您提供所需的内容
https://regex101.com/r/FsC6j8/1
相关问题 更多 >
编程相关推荐