[FEATURE] Add multiple conditions to filters
Describe the bug set the case to "findstring|(?i)ignorestring
Minecraft Info Minecraft information:
- AdvancedChat-2.0.3-1.15.2-beta.jar
To Reproduce Steps to reproduce the behavior:
- Go to 'chatfilter'
- Set filter like described
- Set filter methode to REGEX
- Save and test in chat.
Expected behavior The ignorecase in the chatfilter won't work.
May have accidentally told the wrong regex filter for ignore case. The ? and the i need to be reversed. This should work:
findstring|(i?)ignoreString
Sorry but still won't work. findstring|(i?)ignoreString will give me a sound notification if i write both in chat.
Sorry, but what exactly are you trying to have the regex do? I was using an online regex tester and it said that ?i was incorrect, and that is why I told you that i? would work. It is actually (?i) that works. The regex that is correct and what you were using (findstring|(?i)ignoreString) will notify you if it finds 'findstring' exactly, and then 'ignoreString' in any case (i.e. 'IGNOREstRing', 'ignorestring'... etc). I just tested it on my client and it works as expected.
Can you give me your full regex expression that you are using without the placeholder names?
[13:00:47] [main/INFO]: [CHAT] [Plot Chat][2;5] [Master] sphings ? : findstring ignoreString [13:00:58] [main/INFO]: [CHAT] [Plot Chat][2;5] [Master] sphings ? : ignoreString
{ "name": "Default", "active": true, "findString": "findstring|(i?)ignoreString", "findType": "regex", "replaceType": "none", "replaceTo": "AWESOME!", "notifySound": "BEACON_ACTIVATE", "soundPitch": 1.0, "soundVol": 1.0, "replaceBackgroundColor": false, "color": { "red": 0, "green": 0, "blue": 0, "alpha": 255, "color": -16777216 }
Will give me a sound even if i only type the ignoreString into the chat.
{ "name": "Default", "active": true, "findString": "findstring|(?i)ignoreString", "findType": "regex", "replaceType": "none", "replaceTo": "AWESOME!", "notifySound": "BEACON_ACTIVATE", "soundPitch": 1.0, "soundVol": 1.0, "replaceBackgroundColor": false, "color": { "red": 0, "green": 0, "blue": 0, "alpha": 255, "color": -16777216 }
[13:05:49] [main/INFO]: [CHAT] [Plot Chat][2;5] [Master] sphings ? : ignoreString [13:05:54] [main/INFO]: [CHAT] [Plot Chat][2;5] [Master] sphings ? : findstring ignoreString
Will also give me a sound alert on both lines.
Then it works how the expression works. It doesn't 'ignore' a string with that expression, it ignores case on that string. I currently don't know how to accomplish what you are trying to do. You may want to google some regex expression help. If I find anything I'll let you know.
[13:05:49] [main/INFO]: [CHAT] [Plot Chat][2;5] [Master] sphings ? : Hey there ... [13:06:49] [main/INFO]: [CHAT] [Plot Chat][2;5] [Master] TESTUSER ? : Hey sphings whats up? [13:07:49] [main/INFO]: [CHAT] [Plot Chat][2;5] : Welcome to the communityfarm. regards sphings
In the first line i don't want to get an audio notification, cuase i'm writing my self. so i thougt, i can ignore these line with (?i)sphings ? :
in the second line i want to get a notification, cause someone wrote my name in chat.
in the third line i don't want to get an alert cuase this message was generated out of plotsquared every time i visit my plot. so i added (?i)communityfarm
I thout it would be possible to use the regex like this: sphings|(?i)sphings ? :|(?i)communityfarm
I hope you understand what i want to do :)
I'm sorry, I have been messing around with regex for a bit and am not experienced enough to come up with an answer for you. You could maybe do some research online. I may add multiple cases for filters to be able to achieve what you want in the future.
That would be really great. I'm also note the buddy for regex :D
I know that this question is 4 months old and you probably don't need it anymore, but "(?<!] |regards )sphings" should do what you described. (?<! .... ) ist the beginning of a negative lookbehind and if any of the following strings appears before sphings, the regex fails. So "] " stops the notification when you write something yourself, because it detects the closing bracket in [Master] before your name. And "regards " stops the notification for the plot message. The "|" works as an or and seperates the two strings in the negative lookbehind
Children should fix this issue :)