正则表达式中的新增功能,尝试在服务器上捕获字符串仅以value1开头的文件,但是如果文件中有value1和下一个字符串value2,则不将其添加到输出中>]
keyword = re.findall(r'^process.args=spring.*?xml(?!process.script=true)', line,re.S)
有任何建议吗?
需要这样的输出:
xxxx xxx xxx xxx
process.args=spring.xxxx.xml
process.script=true
xxxx xxx xxx xxx\n```
output after regex : None
and
```xx xx xxx xxx xxx
xxxx xxx xxx xxx
process.args=spring.xxxx.xml
xxxx xxx xxx xxx```
output after regex : process.args=spring.xxxx.xml
正则表达式中的新增功能,尝试在服务器上捕获字符串仅以value1开头的文件,但是如果文件中有value1和下一个字符串value2,则不将其添加到输出关键字= re.findall(r'^ process.args =中。 ..
在您的模式中,在xml(?!process
之后立即使用负前瞻xml
。但是因为它在字符串的末尾,所以可以在\r?\nprocess