Skip to content

Insufficient escape in first name #18

@nhahtdh

Description

@nhahtdh

From https://github.com/callumacrae/tryregex/blob/master/app/assets/js/globalFuncs.js#L72

data.firstEscaped = firstName.replace(/([$()*+.?\[^|\]])/g, '\\$1');

It is missing escape for {, }, \ and / (the last one for RegExp literal only). The code could be changed to:

data.firstEscaped = firstName.replace(/([$()*+.?\[^|\]{}\/\\])/g, '\\$1');

Or without using capturing group:

data.firstEscaped = firstName.replace(/[$()*+.?\[^|\]{}\/\\]/g, '\\$&');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions