search

メソッド Type method
文字列.search(/検索文字列/オプション) Format string. Search (/ search text / options)
Commentary
文字列を正規表現を使って検索します。 You can search using a regular expression string. オプションのg(グローバルマッチ)、i(英大文字、小文字無視)、m(行単位でのマッチ)は省略することができます。 The optional g (global matching), i (in English capital letters, lower case ignored), m (in units of matched lines) can be omitted. 検索結果は見つかった文字列を配列で返します。 Search results will return an array of strings found. 配列の個数を調べることでいくつマッチしたかを調べることができます。 You can check to see if the number of matches by examining the number of the array. 見つからなかった場合はnullを返します。 Otherwise returns null.
サンプルコード Sample code
str = "Sample_sample123"; str = "Sample_sample123";
n = str.search(/12/g); n = str.search (/ 12 / g);
outputs[0] = n; outputs [0] = n;