Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The MOMMY_FORBIDDEN_WORDS setting doesn't support regex filtering #103

Closed
fuel-pcbox opened this issue Feb 19, 2024 · 6 comments · Fixed by #109
Closed

The MOMMY_FORBIDDEN_WORDS setting doesn't support regex filtering #103

fuel-pcbox opened this issue Feb 19, 2024 · 6 comments · Fixed by #109
Assignees
Labels
feature New feature or request

Comments

@fuel-pcbox
Copy link

fuel-pcbox commented Feb 19, 2024

I need this setting to support regex filtering with hex escapes so that I can fully avoid triggering my Tourette's when making use of this setting, as typing my triggers or even just reading them will trigger it, thus causing me to twitch VERY painfully. However, the documentation for this setting currently makes no mention of regex filtering at all.

EDIT: Upon reading the code, it seems it doesn't support regex filtering at all.

@fuel-pcbox fuel-pcbox changed the title Documentation is unclear on whether or not regex filtering is supported while using the MOMMY_FORBIDDEN_WORDS setting The MOMMY_FORBIDDEN_WORDS setting doesn't support regex filtering Feb 19, 2024
@FWDekker FWDekker self-assigned this Feb 19, 2024
@FWDekker FWDekker added bug Something isn't working feature New feature or request labels Feb 19, 2024
@FWDekker
Copy link
Owner

you're right, regex filtering is not (yet?) supported. sorry if i was not clear and falsely got your hopes up. i assumed that exact matching would at least be somewhat useful in that regard.

i also assumed hex escapes would work inside the pattern matching, but unfortunately not. i will investigate how to make that work, it should be relatively easy for me to get working. (i'll let you know once that is implemented.)

if i manage to get both (1) hex escapes and (2) hex ranges (e.g. \146-\148 for the range of lowercase letters f until h) working, how complete of a solution would that be for you?

@fuel-pcbox
Copy link
Author

fuel-pcbox commented Feb 19, 2024

I would still need general regex functionality sadly, as many of my Tourette's triggers have a TON of spelling variations that ALL need to be avoided. Luckily, I already have a couple of regexes that cover ALL of them, or at least, should lol. They're currently being used in a filter script for my IRC client. :P

@FWDekker
Copy link
Owner

the easiest way for me to do this would be to filter out individual templates and variables before they are assembled, but that might not be sufficient if you have complex multi-word triggers.

for example, let's say

  • the templates are %%name%% is going for a walk and i will visit %%name%%,
  • possible values for %%name%% are john, jane, and jay, and
  • your triggers are jon and john (with regex /joh?n/).

with my approach, mommy will remove possible values for %%name%% that match the regex (i.e. remove john), so no triggering content will be displayed. mission accomplished :)

however, if the triggers are visit jon and visit john (with regex /visit joh?n/), then my approach won't work. mommy will check possible values for %%name%% with the regex, but since john doesn't match the regex, mommy will allow it, and potentially show triggering content :(

please let me know whether you think this solution will be good enough :)

@FWDekker FWDekker removed the bug Something isn't working label Feb 23, 2024
@fuel-pcbox
Copy link
Author

No, none of my triggers are multi-word, they're all very simple and EXTREMELY common single words. So that won't be necessary.

@FWDekker
Copy link
Owner

nice timing, i just created #109 :P

i will include the feature in v1.5.0. you can check which version you have with mommy -v. also, importantly, please note that, unfortunately, it doesn't support hex escapes, only octal escapes. i wrote a bit more details about that in the pr, in #109.

@FWDekker
Copy link
Owner

mommy v1.5.0 has been released and is now available as explained in the installation instructions :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants