empty string filtering

These are old archives. They are kept for historic purposes only.
Post Reply
Ozy
Posts: 5
Joined: Thu Mar 30, 2006 9:21 pm

empty string filtering

Post by Ozy »

Hello guys,

What is proper regex to filter out empty characters (spaces) string of any length. More spacific if someone someone post "_" or "____" or "________" etc (_ is space) that would be filtered however when someone go for "_hello" or "_hello_there_" etc that will pass. So for example:

/spamfilter add cN block - Empty_string_detected. <someregex>

What should be used for <someregex> to fit this need? I hope this should be easy for people familiar with regex syntax which unfortunately i'm not.

Many thanks in advance and happy holidays everyone. :)
Jobe
Official supporter
Posts: 1180
Joined: Wed May 03, 2006 7:09 pm
Location: United Kingdom

Re: empty string filtering

Post by Jobe »

Try:
^\s*$

Which will also match "" too.
Your IP: Image
Your Country: Image
Ozy
Posts: 5
Joined: Thu Mar 30, 2006 9:21 pm

Re: empty string filtering

Post by Ozy »

Thanks Jobe1986 however:

Error in regex '^\s*$': Regular expression is too broad

I've tried with badword block (with idea to mlock +G later on channels where i need this) but with the same type of error. :/
Jason
Posts: 570
Joined: Mon Jun 14, 2004 5:09 pm

Re: empty string filtering

Post by Jason »

Match: " {2,}"
Replace: " "
Why the hell can't my signature be empty?
"Your message contains too few characters."
Ozy
Posts: 5
Joined: Thu Mar 30, 2006 9:21 pm

Re: empty string filtering

Post by Ozy »

Solved with "^ {1,}" to "" for what I needed. Many thanks everyone! :)

edit: changed to better and actual solution.
Post Reply