Discovered in monitor-oxc: https://github.com/oxc-project/monitor-oxc/actions/runs/10720462114/job/29726880245
Input:
/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
Expected:
esbuild: https://esbuild.github.io/try/#dAAwLjIzLjEALS10YXJnZXQ9ZXMyMDE1AGNvbnN0IFVSTl9SRUcgPSAvKFtcZGEtel1bXGRcLWEtel17MCwzMX0pOigoPzpbXHchJCcoKSorLFwtLjo7PUBdfCVbXGRhLWZdezJ9KSspL2l1Owo
/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
Oxc Output:
new RegExp("([\\da-z][\\d-a-z]{0,31}):((?:[\\w!$'()*+,-.:;=@]|%[\\da-f]{2})+)", "iu")
This is a really weird one ...
/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
^ This backslash
The linter reports unnecessary backslash, but we can't actually remove it, nor need to transform it 😵