Closed Ateya9 closed 2 years ago
Hey! Thanks, it's very interesting to see how you've solved it. It's pretty similar to the way I'm doing it.
I'm also generating all the substrings of a given query, and then I match it against a list of strings (which are all the other mods + a collection of other colliding strings, which you named banned words).
I do generate all the permutations though as some of the shortest matching word can get pretty long. The program that generates the GeneratedMapMods.ts file is pretty fast, it generates everything around ~600ms so it's worth getting all the options and choosing the shortest one.
Matches containing spaces has to be counted as +2 in length as you have to escape it with quotes in the PoE search bar. A bug I stumbled upon was that if the word ends with a space you cannot use it as the last part of the regex, even when escaping it with quotes as the search bar actually trims the spaces at the end, meaning that "abc|hello "
will become "abc|hello"
(without the space), so there are some rules around that too 😁
Thanks for sharing! 👍
I started working on an idea similar to poe.re a while ago, but never continued it. If any of the code is useful to you, you're welcome to use it. It's a set of python files that creates a list of regular expressions that match a specific mod or a set of specific mods ahead of time, eliminating any potential false positives. It's missing features and isn't tested extensively in game, but I thought I'd let you know anyway.
The repo is: https://github.com/Ateya9/PoeRegEx-Setup