reg exp in bans lua

Bug #888280 reported by Pirre
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ADCH++
Fix Released
Undecided
Unassigned

Bug Description

I tried to use +bannickre and +banmsge in development code, using:

+banmsgre 30 <.*\n.*\n.*> some reason
+bannickre 1440 <.+(?<!(\[DS[1234]\]|\[AK[12]\]))> some reason

As in the above example, I want to ban people writing multi-newline messages and force a certain username format. In my opinion and according to ADCH++ documentation, those regular expressions should work, but they don't. How can i use regular expressions in this functions properly? I also tried with Lua patterns, to no effect. Please tell me how can I use those functions...

Revision history for this message
Pirre (pierreparys) wrote :

shewing my previous comment, seems that re is based on the lua string.match(patern) if so this is a bug so changing it to a bug

ps lua regexp http://www.wowpedia.org/Pattern_matching seems to work, ifi am wrong someone correct me please ....

Revision history for this message
lrm (lrmucha) wrote :

Indeed, I have managed to solve my problem with Lua patterns:

+bannickre 1 <[^%]]$> some reason
+bannickre 1 <[^1234].$> some reason
+bannickre 1 <[^SK]..$> some reason
+bannickre 1 <[^DA]...$> some reason
+bannickre 1 <[^%[]....$> some reason

and so forth (exceptions, etc...)

However, I've encountered anoter issue:
+banmsgre 10 <%>%>%>> some reason
<Hub> Messages that match "%" will be blocked (Level: 10) (Reason: %>%>> some reason) (Expires: never) (Bans for 10 minutes)

+banmsgre 10 <%>%>%>> some reason 0
 <Hub> Messages that match "%" won't be blocked anymore

So, it looks like its not posisble to use patterns that include the ">" delimiter, even with an escape character. Other tested symbols, like "<", "*" and "%s", do work.

Including POSIX regexes in the next release would be a great feature :).

Revision history for this message
lrm (lrmucha) wrote :

Tested one more:
+banmsgre 10 <%W%W%W%W%W> some reason
<Hub> Messages that match "%w%w%w%w%w" will be blocked (Level: 10) (Reason: some reason) (Expires: never) (Bans for 10 minutes)

+banmsgre 10 <%W%W%W%W%W> some reason 0
<Hub> Messages that match "%W%W%W%W%W" are not being blocked

+banmsgre 10 <%w%w%w%w%w> some reason 0
<Hub> Messages that match "%w%w%w%w%w" won't be blocked anymore

So, upper case set-complement, as shown in http://www.wowpedia.org/Pattern_matching, also does not work.

Revision history for this message
lrm (lrmucha) wrote :

Today i have experimented with
+banmsgre [^%w%.][^%w%.][^%w%.][^%w%.] some reason

I don't know if this is intended, but the pattern matches diacritical signs, like ą, ę, ś, ć, ł, ż, ź.

Extending [^%w%.] to [^%w%.ĘęÓ󥹌śŁłŻżŹźĆćŃń] solves the problem, but i wonder how it behaves with other diacritics or other alphabets. Probably a Lua issue, but nevertheless worth mentioning.

Revision history for this message
Pirre (pierreparys) wrote :

For problems with those expressions you best use forums regarding Lua and their patern matching.

The lower case was done intentialy to make it working for a user not knowing so much about lua and who doesnt want to write 60 lines of posible matches to block 1 search or msg

As soon the documentation is update and a correct example is puted there this bug will be closed :)

Revision history for this message
eMTee (realprogger) wrote :

Docs updated

Changed in adchpp:
status: New → Fix Committed
Revision history for this message
Pirre (pierreparys) wrote :

in release 2.8.0

Changed in adchpp:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.