回答編集履歴

1

ついき

2019/03/11 02:30

投稿

papinianus
papinianus

スコア12705

test CHANGED
@@ -3,3 +3,21 @@
3
3
  if (result !== null && result.length > maxLength) {
4
4
 
5
5
  ```
6
+
7
+
8
+
9
+ あらためてコードを読み直しましたが、↓こちらのほうがいいかもしれない。
10
+
11
+
12
+
13
+ ```javascript
14
+
15
+ var result = myMsgs[i][0].getPlainBody().match(/1234[^\n]*/g); // 正規表現で本文中の文字列を取り出す。
16
+
17
+ //ここに↓を入れたほうがいいかもしれない
18
+
19
+ if(result === null) { result = [];}
20
+
21
+ Array.prototype.push.apply(valMsgs[i], result); // 元の配列に取り出した配列を追加する。
22
+
23
+ ```