回答編集履歴
1
修正
test
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
for (var i = 0, len = brackets.length; i < len; ++i) {
|
14
14
|
|
15
|
-
brackets[i] = brackets[i].slice(1, -1);
|
15
|
+
brackets[i] = brackets[i].slice(1, -1).match(/-|[^-]+/g);
|
16
16
|
|
17
17
|
}
|
18
18
|
|
@@ -26,9 +26,9 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
console.log(JSON.stringify(sample('テスト1{=test1-string1.test2-string2}-終わり'))); // ["=test1-string1.test2-string2"]
|
29
|
+
console.log(JSON.stringify(sample('テスト1{=test1-string1.test2-string2}-終わり'))); // [["=test1","-","string1.test2","-","string2"]]
|
30
30
|
|
31
|
-
console.log(JSON.stringify(sample('-{test1-string1}-{test2}-{test3-foo3-piyo3}'))); // ["test1-string1","test3-foo3-piyo3"]
|
31
|
+
console.log(JSON.stringify(sample('-{test1-string1}-{test2}-{test3-foo3-piyo3}'))); // [["test1","-","string1"],["test3","-","foo3","-","piyo3"]]
|
32
32
|
|
33
33
|
```
|
34
34
|
|