Skip to content
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 opened this issue Jan 14, 2014 · 0 comments
Closed

angular.copy doesn't preserve RegExp options #5781

greglockwood opened this issue Jan 14, 2014 · 0 comments

Comments

@greglockwood
Copy link

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);
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants