Replace Words

These are old archives. They are kept for historic purposes only.
Post Reply
Guest

Replace Words

Post 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!!!
Jason
Posts: 570
Joined: Mon Jun 14, 2004 5:09 pm

Post by Jason »

? and * are special characters in regular expressions. Use \? and \* to match them.
Why the hell can't my signature be empty?
"Your message contains too few characters."
Guest

Post by Guest »

badword::word contains an invalid regex: Regular expression is too broad

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

It doesnt work :(
Jason
Posts: 570
Joined: Mon Jun 14, 2004 5:09 pm

Post by Jason »

You wanted: \?\?\?+


\?? would mean:

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

It would therefore match everything.
Why the hell can't my signature be empty?
"Your message contains too few characters."
Guest

Thx Jason

Post 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!!!
Jason
Posts: 570
Joined: Mon Jun 14, 2004 5:09 pm

Post by Jason »

Yes, the regex matching is the same. Regex exists far beyond unreal. Google for it.
Why the hell can't my signature be empty?
"Your message contains too few characters."
Guest

Post 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
aquanight
Official supporter
Posts: 862
Joined: Tue Mar 09, 2004 10:47 pm
Location: Boise, ID

Post by aquanight »

Replace is literal text. It's not a regex, and it doesn't do capture substitution.
Guest

Yup

Post 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
Dukat
Posts: 1083
Joined: Tue Mar 16, 2004 5:44 pm
Location: Switzerland

Post by Dukat »

If you don't make mistakes, you aren't really trying.
- Coleman Hawkins
Guest

Thx

Post by Guest »

Thx Dukat this is the one i was searching for :)
Bronx AnarchY
Posts: 53
Joined: Thu Apr 06, 2006 3:35 pm
Location: Turkey
Contact:

Re: Thx Jason

Post 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 :(
Post Reply