`StringTemplate` does not replace variables with special regex characters
axieum opened this issue ยท 2 comments
Expected behavior
new StringTemplate().add("reason", "ABC$$XYZ").format("Oh no!\n_${reason}");
Oh no!
_ABC$$XYZ_
Observed/actual behavior
new StringTemplate().add("reason", "ABC$$XYZ").format("Oh no!\n_${reason}");
[23:00:46] [JDA MainWS-ReadThread/WARN] (StringTemplate) Could not replace variable 'reason': Illegal group reference
Oh no!
_${reason}_
Steps/models to reproduce
Include reserved regex characters in a variable's value and when trying to replace it, it will fail. For example $$
is an invalid regex group reference.
Version
v1.1.0-beta.3
Agreements
- I am running the latest version of the mod.
- My version of Minecraft is supported.
- I have searched for and ensured there isn't already an open issue regarding this.
Other
No response
@axieum Hi, can I work on this issue?
I have some idea about the problem here, but is it okay to modify the StringTemplate
class code?
Thank you, please do reach out if you have any questions about how the me.axieum.mcmod.minecord.api.util.StringTemplate
class operates.
My Discord is Axieum#1001
๐