NP_Blacklist に食わせる正規表現を検討中。今やっつけようとしているのは、URI を羅列するタイプのやつ。



URI を表す文字列が 4行以上連続で現れたら蹴ることにして、とりあえず以下のように書いてみた。


(http://.+$){4,}

なんかエラーになるぞと怒られた。いろいろ試したのだが、なんでエラーなのかわからない。


(http://.+(\r|\n|\r\n)){4,}
(http://.+(\x0d|\x0a|\x0d\x0a)){4,}

.+.* にしても同じだし、{4,}{4} にしても変わらない。


(ppp){4,}

これは通るらしい。なんのこっちゃ。

I'm trying some regular expressions for NP_Blacklist. My current task is kicking out the spams which are instances of URIs.

At first, I tried to ban if 4 or more lines contain URI strings. So I wrote:


(http://.+$){4,}

I got an error. I'm not sure what was wrong, even after I tried some other expressions.


(http://.+(\r|\n|\r\n)){4,}
(http://.+(\x0d|\x0a|\x0d\x0a)){4,}

Still I got errors though I changed .+ to .*, nor {4,} to {4}.


(ppp){4,}

This one worked. Hmm, I can't get it.