PrismarineJS / prismarine-chat

A parser for a minecraft chat message
MIT License
34 stars 21 forks source link

Collect examples of chat to parse and build a benchmark #51

Open rom1504 opened 3 years ago

rom1504 commented 3 years ago

And benchmark various implementation

Probably there is a trade off between parse everything and never crash that we can propose to users

u9g commented 3 years ago

Some chat examples:

wvffle : meh
wvffle: meh
wvffle: meh
wvffle ~ meh
<wvffle> meh
<wvffle> meh (meh)
wvffle: (meh)
moderator wvffle: meh
[wvffle] meh
[a] [b]wvffle » meh
[a] [b] wvffle » meh
[a] ~wvffle: meh
[] wvffle - meh

from https://github.com/PrismarineJS/mineflayer/pull/2247#issuecomment-963397225

U5B commented 2 years ago

Basic username regex for hypixel: (?:|\[[a-zA-Z]{3,}\+{0,3}\] )([0-9a-zA-Z_]{1,16}) matches

0w0
[VIP] 0w0
[VIP+] 0w0
[MVP] 0w0
[MVP+] 0w0
[MOD] 0w0

We would need to make seperate regexes for the different hypixel games.

Chitasa commented 2 years ago

(?:\(.+?\)|\[.+?\]|.)*?(\w{3,16}) seems to fix catastrophic backtracing

There seems to be a problem with Party> IGN: message as well