如何在SQL查询中捕获除法

时间:2016-07-03 01:27:38

标签: python regex

我想在sql查询中捕获除法。

所以我认为正则表达式应该起作用

(s+)\/(s+)

测试

a/b = b/d and c/e is not equal to b/e

我在http://regexr.com/使用它但似乎没有返回结果。 我在这里做错了什么?

1 个答案:

答案 0 :(得分:0)

  • 使用\S匹配非空格,而不是\s。好像你错过了反斜杠。
  • 您无需在Python正则表达式中转义/
>>> 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')]