However, if I remove it, browsers complain about invalid regex.
Did I miss something?
Copy code
private val imageLinkRegex = "!\\[[^\\[]+\\]\\([^)]+\\)".toRegex()
k
Klitos Kyriacou
06/28/2024, 11:25 AM
IntelliJ seems correct. Paste your regex into regex101.com. Then in another tab, paste the same regex without escaping the "]". Compare the difference between the two tabs.
h
hfhbd
06/28/2024, 11:46 AM
Regex implementations are different based on each platform, so I really recommend to test it on each platform and not blindly trust IntelliJ focussing on JVM.