You must remove the /g from the regex, see updated plunkr.
According to the docs:
Note: Avoid using the g flag on the RegExp, as it will cause each successive search to start at the index of the last search's match, thus not taking the whole input value into account.