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
Description
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);