Javaregex-matcher-hastransparentbounds

提供:Dev Guides
移動先:案内検索

java.util.regex.Matcher.groupCount()メソッド

説明

  • java.time.Matcher.hasTransparentBounds()*メソッドは、このマッチャーの領域境界の透明度を照会します。

宣言

以下は* java.time.Matcher.hasTransparentBounds()*メソッドの宣言です。

public boolean hasTransparentBounds()

戻り値

このマッチャーが透明な境界を使用している場合はtrue、そうでない場合はfalse。

次の例は、java.time.Matcher.hasTransparentBounds()メソッドの使用法を示しています。

package com.finddevguides;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MatcherDemo {
   private static String REGEX = "(a*b)(foo)";
   private static String INPUT = "aabfooaabfooabfoob";

   public static void main(String[] args) {
      Pattern pattern = Pattern.compile(REGEX);

     //get a matcher object
      Matcher matcher = pattern.matcher(INPUT);
      System.out.println("hasTransparentBounds(): " + matcher.hasTransparentBounds());
   }
}

上記のプログラムをコンパイルして実行すると、次の結果が生成されます-

hasTransparentBounds(): false