1
我如何能实现逆匹配使得例如哈斯克尔正则表达式,PCRE否定表达
getAllTextMatches $ "foobar bar bl a" =~ pattern :: [String]
将prodcuce不在多个空格的字符串列表。
我已经试过
getAllTextMatches $ "foobar bar bl a" =~ "(\\s\\s+)" :: [String]
返回我这个列表预期:[" "," "," "]
现在我试图否定的表达方式如下
getAllTextMatches $ "foobar bar bl a" =~ "(?!\\s\\s+)" :: [String]
其返回
[""]
而
我想收到:
个["foobar", "bar", "bl", "a"]
或作为另一个例子,而
getAllTextMatches $ "foobar /* bla */ bar bl a" =~ "/\\*[^*]*\\*/" :: [String]
回报["/* bla */"]
我woud希望收到:["foobar "," bar bl a"]
通过否定"/\\*[^*]*\\*/"
@DominikDanter:你说得对,这些模式不起作用,我将它们删除。 –