Skip to content

Add support for custom text modifier using regex #7

Open

Description

@tianyume

Add support for custom text modifier using regex, maybe with some examples. In different games, users can use different text modifiers to extract correct texts.

Activity

  1. tinyAdapter commented on Jun 30, 2019

    @tinyAdapter
    Member

    I agree. And this is a flexible solution for any “regular” incorrect texts. But there still need some specs. What configuration process can be the most convenient for end-users? You know, if something is related to regex, things could become much more complicated.

    As far as I'm concerned, here are the things to take into account:

    • what is the configuration format: an array as parameters for String.replace["/^a(one)b(another)c$/", "{$1}", "[$2]"] ?
    • how does a user test if its regex is OK for specific texts: hot reload middlewares when configuration file is saved, regenerate the last text after hot reload accomplish ?
    • what if something error happened: send error message to the next middleware and show it to the user as the final text ?

    Then a big refactor comes...

  2. tianyume commented on Jun 30, 2019

    @tianyume
    Author

    For the configuration, I believe an array of dictionary may be better. For example:
    [ { "matcher": "/(.{4,})\\1+/g", "replacer": "$1", "recursive": true // Maybe just use recursive as default } ]
    Compared to using an array directly, it's easier to maintain and be validated. Also, if any further changes are needed, we can simply add some more fields to make it compatible to older versions.

    For the error message and hot reload, I'd suggest to do the following step by step:

    1. Define the initial configuration format, loading configuration at the start time, add regex replacer feature into current middleware. Building an initial workable solution. (Non hot reload version)
    2. Add error message exposure to the users. Maybe something like adding a debug button, creating a new window displaying all the debug messages. I'm not sure what would be the best practice either. (Seems that the debug messages are either truncated in CMD or broken, I cannot get the full debug messages in CMD)
    3. Add hot reload configuration feature into the whole configuration system. If users can get the raw texts, like in step 2, they can test their regex online. This would be a good UX enhancement but not as urgent as the previous steps.
  3. tinyAdapter commented on Jun 30, 2019

    @tinyAdapter
    Member

    OK, I think this is a feasible solution. But I have no enough time to implement it these days...You may see that there are so many plans in this repo, maybe after a month or two can I finish all my work and thus turn to implement these features. 😥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions