ITADN

Swapper and URLs regex

#99Closedtriesharder 创建于 2025-04-06
bugTBR
T
trieshardercommented
## Checklist > Before submitting a bug report, please review the checklist ### I'm sure that... - [x] ...I'm using latest version of Socialismus. - [x] ...I have latest versions of all official modules. - [x] ...it happens without any client modifications installed (e.g. mods/optifine/fabric...). - [ ] ...all plugin/modules dependencies are fulfilled. - [x] ...this isn't a duplicate of an existing issue. ## Describe the bug I want to format URLs in chat, so im using this configuration: ``` placeholders: - $/(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/g ``` But when the plugin loads it cuts my configuration into ``` placeholders: - "$/(https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2" ``` So i try wrapping it as a string, but the plugin throws `java.lang.IllegalStateException: Invalid escape character: \/` So i escape everything as shown in the plugin's example. Result: `$/(https?:\\\\/\\\\/(?:www\\\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\\\.[^\\\\s]{2,}|www\\\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\\\.[^\\\\s]{2,}|https?:\\\\/\\\\/(?:www\\\\.|(?!www))[a-zA-Z0-9]+\\\\.[^\\\\s]{2,}|www\\\\.[a-zA-Z0-9]+\\\\.[^\\\\s]{2,})/g` Which doesn't makes any error to pop in the console, but won't work as shown: ![Image](https://github.com/user-attachments/assets/611d85c8-8109-4b3c-9e86-99862fec8bcd) ## Expected behavior The YML to won't change and/or the regex to work. ## Environment: - OS: Ubuntu 24.04 / Kernel 6.8.0-57-generic (64-bit) - Java: openjdk 21.0.5 2024-10-15 LTS - Platform version: Purpur 1.21.4-2412-9249a2c - Module: Swapper
关闭于 2025-04-24 5 条评论