我想在sql查询中捕获除法。
所以我认为正则表达式应该起作用
(s+)\/(s+)
测试
a/b = b/d and c/e is not equal to b/e
我在http://regexr.com/使用它但似乎没有返回结果。 我在这里做错了什么?
答案 0 :(得分:0)
\S
匹配非空格,而不是\s
。好像你错过了反斜杠。/
。>>> re.findall(r'(\S+)/(\S+)', 'a/b = b/d and c/e is not equal to b/e')
[('a', 'b'), ('b', 'd'), ('c', 'e'), ('b', 'e')]