Page 1 of 1

Replace Words

Posted: Fri May 12, 2006 1:45 pm
by Guest
Ok i've found a way to replace words not only bad words but all the words that i would like to replace.

I've created a file called wordreplace.conf and included it in the unrealircd.conf

include "wordreplace.conf";

Where in the wordreplace.conf are this commands:

badword channel {
word ^(a);
replace A;
};

This one replac the first letter (a) at the beginning with the big (A)
Example:
User wrote: | 15:29:41 | <nickname> amin my bro
Other users see this: | 15:29:41 | <nickname> Amin my bro

badword channel {
word (aaa*);
replace aaa;
};

And here User wrote: | 15:29:41 | <nickname> aaaaaaaaaaaaaaa
Other users see this: | 15:29:41 | <nickname> aaa

Or here User wrote: | 15:37:17 | <nickname> jaaaaaaaaaaaaaaa
Other users see this: | 15:37:17 | <nickname> Jaaa

I would like to replace also the characters ??? !!! --- *** tu replace it shourter, but it tells me: badword::word contains an invalid regex: Regular expression is too broad.

I dont have any problems here it works well for me with the first and second one. The point is i would like to add more thinks like: Replace all caps, replace only a word etc. with a simple regex not adding all of them on by on. It takes alote of time and work.

I know this is not the right place to ask about badword, its only for spamfilter, but you guys helped me alote with spamfilter, so i though its better to post my request here.

And is there also a special documentation with regex for badword like the one for spamfilter?

Thank you very much in advance!!!

Posted: Fri May 12, 2006 5:48 pm
by Jason
? and * are special characters in regular expressions. Use \? and \* to match them.

Posted: Fri May 12, 2006 6:19 pm
by Guest
badword::word contains an invalid regex: Regular expression is too broad

badword channel {
word \??;
replace ?;
};

It doesnt work :(

Posted: Fri May 12, 2006 9:50 pm
by Jason
You wanted: \?\?\?+


\?? would mean:

Match if any portion of the string contains '?' zero or more times.

It would therefore match everything.

Thx Jason

Posted: Sat May 13, 2006 3:08 pm
by Guest
Thank you Jason now it works good :D

I got one more question. Are the regex from spamfilter the same as for badword? And if not, does exsist a documentetion for badword like the one for spamfilter?

But, if the regex are the same can i use this one to replace 100% Caps with small letters.

Where this one in spamfilter blocks the text in caps with spaces more than 25 char..

(?-i)[A-Z ]{25}

Can i use this one in badword to replace f.ex.

badword channel {
word (?-i)[A-Z ]{25};
replace (?-i)[a-z ]{25};
};

this one doesnt work it will reply the (?-i)[a-z ]{25} text ever time some on writes with caps.

I think it would be a good idea to open a new Post for badword or to make a documentation like the spamfilter doc.

Thank you all here in UnrealiRCD Forum!!!

Posted: Sat May 13, 2006 5:27 pm
by Jason
Yes, the regex matching is the same. Regex exists far beyond unreal. Google for it.

Posted: Sun May 14, 2006 9:50 am
by Guest
Yes but it doent work like i though because the target replace is not working with the regex. I mean even if i would put a regex on WORD (?-i)[A-Z ]{25} for caps and put at REPLACE like (?-i)[a-z ]{25} it will reply only the regex (?-i)[a-z ]{25} when users write in caps. It will not reply on small letters.

I though it would work like this, but i think i will replace only some words without regex. Like WORD Shit replace Shoot :P

Posted: Mon May 15, 2006 1:06 am
by aquanight
Replace is literal text. It's not a regex, and it doesn't do capture substitution.

Yup

Posted: Mon May 15, 2006 11:40 am
by Guest
aquanight wrote:Replace is literal text. It's not a regex, and it doesn't do capture substitution.
Yeah, Unfortunately it is true.
Can you plz give me the link of spamfilter explenation for the commands to lern more about how to use spamfilter regex. I know there is or was such a documentation, but i cant find it any more. Thx

Posted: Mon May 15, 2006 1:57 pm
by Dukat

Thx

Posted: Tue May 16, 2006 10:22 am
by Guest
Thx Dukat this is the one i was searching for :)

Re: Thx Jason

Posted: Tue May 16, 2006 12:01 pm
by Bronx AnarchY
Guest wrote:Thank you Jason now it works good :D
hello guest,

can paste your replace words block to here, I want it thnx

I use ;

badword channel {
word (aaa*);
replace aa;
};
badword channel {
word (bbb*);
replace bb;
};
badword channel {
word (ccc*);
replace cc;
};
badword channel {
word (ddd*);
replace dd;
};
badword channel {
word (eee*);
replace ee;
};
badword channel {
word (fff*);
replace f;
};

......


for all charecter add all charecter :(