「Java言語」Javaの正規表現式の簡単サンプル(Patternの使い方)

javaコード:

import java.util.regex.*;

public class Regex1{
public static void main(String args[]) {
String str="For my money, the important thing “+
“about the meeting was bridge-building";
String regEx="a|f"; //aまたはff
Pattern p=Pattern.compile(regEx);
Matcher m=p.matcher(str);
boolean result=m.find();
System.out.println(result);
}
}

Development

Posted by arkgame