Python正则表达式匹配isalnum()和isspace()的任何组合,但不匹配两个同时换行符

2024-09-29 23:24:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我想分开

"Use a regexp that matches any combination\nthat satisfies Python's\n\nisalphanumeric() or isspace() functions, but   not two simultanionus\nnewline symbols" 

变成一个

^{pr2}$

使用findall()方法列出。在

我写过:

re.findall("[\w\s]*", text)

但现在我需要添加一些类似“except for \n \n”之类的内容,它可以使我的表达式更符合当前的要求。在


Tags: orthatusenotanyfunctionsbutregexp

热门问题