回答編集履歴

1

読みやすく編集。

2017/10/28 15:51

投稿

kei344
kei344

スコア69400

test CHANGED
@@ -1,14 +1,14 @@
1
- match は配列を返します。また、`g`フラグが無ければ単一の結果を配列で返します。あと例ではそのまま書いておきましたが `/>+\d{1,3}/g` の `+` はこの場合不要です。
1
+ match は配列を返します。また、`g`フラグが無ければ単一の結果を配列で返します。あと `/>+\d{1,3}/g` の `+` はこの場合不要です。
2
2
 
3
3
  ```JavaScript
4
4
 
5
5
  let text = 'text内に¥>+数字が複数( 例: >2>3 )あった際に最初のアンカーしかif以下のメソッドが';
6
6
 
7
- console.log( text.match(/>+\d{1,3}/) ); // Array [ ">2" ]
7
+ console.log( text.match(/>\d{1,3}/) ); // Array [ ">2" ]
8
8
 
9
- console.log( text.match(/>+\d{1,3}/g) ); // Array [ ">2", ">3" ]
9
+ console.log( text.match(/>\d{1,3}/g) ); // Array [ ">2", ">3" ]
10
10
 
11
- ```**動くサンプル:**[https://jsfiddle.net/urrbrdLo/1/](https://jsfiddle.net/urrbrdLo/1/)
11
+ ```**動くサンプル:**[https://jsfiddle.net/urrbrdLo/2/](https://jsfiddle.net/urrbrdLo/2/)
12
12
 
13
13
 
14
14