cant use < or > in regex. string.replace(/>/g, '>').replace(/</g, '<'); breaks the script
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
People
(Reporter: bob.t.allen, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0
Steps to reproduce:
string.replace(/>/g, '>').replace(/</g, '<'); breaks my script
Actual results:
It broke the script. works fine in chrome. Tried a bunch of things like escaping. It will work as a char replacement but replace only does the first one and I would need to write a silly while loop to get all of them just for this. The script is here: https://github.com/SuperIntuitive/SuperIntuitive/blob/master/editor/objects/scripter.js
Expected results:
it should replace the <> with < and > respectively.
Comment 1•6 years ago
|
||
the comment is rendered incorrectly because of bug 1642288.
here's correct "Steps to reproduce" and "Expected results".
Steps to reproduce:
string.replace(/>/g, '>').replace(/</g, '<');breaks my scriptExpected results:
it should replace the
<>with<and>respectively.
Comment 2•6 years ago
|
||
Do you mean that "<a></a>".replace(/>/g, '>').replace(/</g, '<') returns "<a></a>" instead of "<a></a>" ?
if not, what do you mean by "break" ? what do you observe with the code?
Is there any live example that demonstrates the issue?
Comment 3•6 years ago
|
||
bob.t.allen, thanks for taking the time to report this, but we need a little more information.
This code works correctly for me locally. If you can provide a link to a web page where it's broken, or tell how to set up Superintuitive so we can reproduce it locally, it would help a lot.
Any difference in behavior from Chrome on this sounds like it would be a bug that we would want to fix right away.
Comment 4•6 years ago
|
||
Setting to low severity for now, since we can't confirm the bug. If it's real, it's a big deal.
Comment 5•3 years ago
|
||
Reporter didn't answer NI, therefore resolving as INCOMPLETE.
Updated•7 months ago
|
Description
•