相关疑难解决方法(0)

正则表达式'^ [abc] + $'不能正常工作

我想找到仅包含字母a,b和c的每一行。我有正则表达式

print(re.findall('^[abc]+$', text))
Run Code Online (Sandbox Code Playgroud)

但这段文字没有任何结果:

print(re.findall('^[abc]+$', text))
Run Code Online (Sandbox Code Playgroud)

为什么是这样?我认为问题在于^$字符,但我不明白为什么。

python regex pcre python-3.x

3
推荐指数
1
解决办法
52
查看次数

标签 统计

pcre ×1

python ×1

python-3.x ×1

regex ×1