MahdeenSky / BDPlugins

BetterDiscord Plugins
MIT License
1 stars 1 forks source link

[TextReplacer] Does not work with 'i' modifier: insensitive #10

Open FireBoy00 opened 4 months ago

FireBoy00 commented 4 months ago

I wanted to make it so it replaces all the idk's in my messages into I don't know

Case 1: I used: \b(?i:idk)\b Result: did nothing

Case 2: I used: \b(?:idk|Idk|IDK)\b Result: worked as expected

Conclusion: It did not work to use the i modifier, but it worked to make it use the or (|) Could this be fixed or do I just need to always but all the variants instead of using the insensitive modifier?

EDIT: Also, could you maybe add to let us edit the replacing rules? (This is as a suggestion)

MahdeenSky commented 2 months ago

I wanted to make it so it replaces all the idk's in my messages into I don't know

Case 1: I used: \b(?i:idk)\b Result: did nothing

Case 2: I used: \b(?:idk|Idk|IDK)\b Result: worked as expected

Conclusion: It did not work to use the i modifier, but it worked to make it use the or (|) Could this be fixed or do I just need to always but all the variants instead of using the insensitive modifier?

EDIT: Also, could you maybe add to let us edit the replacing rules? (This is as a suggestion)

Sorry it is too much of a hassle to support the ?i: operator since JS itself does not support it. Elaborate on what you mean by editing the replacing rules.

FireBoy00 commented 2 months ago

Ah, I see, then I'll just use the (|) one and put all the variants I need.

As for the second part, I meant to be able to edit the rules. Right now, I can add a replace rule and I can remove that rule. I can not edit it. For example I added a rule to replace idk with i don't know and I put only two variants (idk and Idk) I forgot to also put the IDK variant. Now, I can only remove that rule and readd it. What I want is to be able to simply edit it and add what I forgot. Hope this made sense. 😅

MahdeenSky commented 2 months ago

Commit: f4f378a Added support for case insensitive toggle on regex. Added support for editing regexes, without deleting and adding a new one.