diff options
author | Airan Shao <shaoairan@gmail.com> | 2017-02-11 14:52:52 +0800 |
---|---|---|
committer | Airan Shao <shaoairan@gmail.com> | 2017-02-11 14:52:52 +0800 |
commit | a91f62267610ce95fee24e4d25493caf7fb9d2b9 (patch) | |
tree | 68af2e5f85a7759ab1c006afb4b421c185b5ddee | |
parent | 97d39b6c2bf533d33538205a399638b63f6baa66 (diff) | |
download | yamljs-a91f62267610ce95fee24e4d25493caf7fb9d2b9.tar.gz |
replaceAll always replace str with ''
Should replace matching string with parameter "replacement", not ''.
-rw-r--r-- | src/Pattern.coffee | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Pattern.coffee b/src/Pattern.coffee index e65fa79..82f96e7 100644 --- a/src/Pattern.coffee +++ b/src/Pattern.coffee @@ -134,7 +134,7 @@ class Pattern count = 0 while @regex.test(str) and (limit is 0 or count < limit) @regex.lastIndex = 0 - str = str.replace @regex, '' + str = str.replace @regex, replacement count++ return [str, count] |