Open tianyume opened 5 years ago
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:
["/^a(one)b(another)c$/", "{$1}", "[$2]"]
?Then a big refactor comes...
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:
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. 😥
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.