Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

angular.copy doesn't preserve RegExp options #5781

Closed
@greglockwood

Description

@greglockwood

The recent change (commit 5cca077..., PR #3474) that copied RegExps did not correctly preserve the flags of the regex.

Thus, code similar to the following should be added within the if (isRegExp(source)) block:

    var options = '';
    if (source.global) options += 'g';
    if (source.ignoreCase) options += 'i';
    if (source.multiline) options += 'm';
    if (source.sticky) options += 'y';
    destination = new RegExp(source.source, options);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions