Prat 3.0

664 - CustomFilters: Search patterns too strict (eg. case sensitivity)

I use the “CustomFilters” module heavily (it's the only reason I installed Prat), yet its searching mechanisms appear to be lacking. In particular, I can't find an option to make searches case insensitive. As a result, I have to create lots of filters eg. “Oondasta” and “oondasta”.

A more broad solution could be to allow arbitrary regex patterns, with case sensitivity being a regex option. Then I could, for example, create a rule matching "ToT|TdD" to match both the English and German names for Throne of Thunder. This would also alleviate another complaint I have which is that it's not easy enough to create many filters with the same rules, but different patterns, since I could just throw them into the same regex.

User When Change
nandchan Apr 10, 2013 at 08:36 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • 2 comments
  • Avatar of Speedwaystar Speedwaystar Jun 26, 2013 at 06:05 UTC - 0 likes

    SOLUTION FOUND!

    the solution to my problem (below) is the undocumented lua frontier pattern match command, %f.

    http:lua-users.org/wiki/FrontierPattern

    • search pattern = %f[%w][Tt][oO][tT]%f[%W]
    • replacement = Throne of Thunder

    results in the following matches/expansions:

    • 'looking for more for regular TOT' ==> 'looking for more for regular Throne of Thunder'
    • 'I would TOTally do that on my rogue' ==> 'I would TOTally do that on my rogue'
  • Avatar of Speedwaystar Speedwaystar Jun 26, 2013 at 03:06 UTC - 0 likes

    CustomFilters uses standard Lua string match calls, which are a subset of regex. they are character-, not word-based, so you can't match "ToT|TdD". however, you can match

    • [Oo]ndasta
    • [Tt][oOdD]TtdD]

    the latter is obviously not ideal, but it's a start.

    atm i'm trying to come up with a string match which prevents the following kind of disaster:

    • input = "Gonna totally do that on my rogue."
    • match = [Tt][oO][Tt]
    • substitution = Throne of Thunder
    • output = "Gonna Throne of Thunderally do that on my rogue."

    now, I could match for

    • %s+[Tt][oO][Tt]%s+

    but this would fail to find ToT if it's the first or last word in the input string, which brings us back to the miserable necessity of having to create multiple filters:

    • ^[Tt][oO][Tt]%s+
    • %s+[Tt][oO][Tt]$
    • %s+[Tt][oO][Tt]%s+

    D:

    or am I missing something?

    Last edited Jun 26, 2013 by Speedwaystar
  • 2 comments

Facts

Last updated
Feb 14, 2014
Reported
Apr 10, 2013
Status
New - Issue has not had initial review yet.
Type
Enhancement - A change which is intended to better the project in some way
Priority
Medium - Normal priority.
Votes
1
Component
Specific Module

Reported by

Possible assignees