Skip to content

Bug report: Utils.parseEscapedChars backslash matching #589

@pro-wh

Description

@pro-wh

Describe the bug
Currently Utils.parseEscapedChars can match up to three backslashes in a replacement, which I think is unintended. As an example problem case, \\\\\\ unescapes to \\\\ instead of \\\. The reproduction link below does a round trip with escape, then unescape.

Following #582, I think we don't need the leading (\\)? and if (a === "\\") anymore. If there's an escaped backslash, it'll match with b equal to \, and whatever comes after will not be affected by the replace operation.

To Reproduce

  • Version: 8.34.2
  • Compile time: 28/06/2019 16:17:13 UTC
  • User-Agent:
    Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0
  • Link to reproduce

Expected behavior
The output should be \\\.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions