本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.compiler.Pattern类的典型用法代码示例。如果您正苦于以下问题:Java Pattern类的具体用法?Java Pattern怎么用?Java Pattern使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pattern类属于com.sun.org.apache.xalan.internal.xsltc.compiler包,在下文中一共展示了Pattern类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: IdCard
import com.sun.org.apache.xalan.internal.xsltc.compiler.Pattern; //导入依赖的package包/类
public static String[] IdCard (String url) throws IOException {
System.out.println(">> start demo......");
//例子:
//把测试图片放到D盘下面,也可以放到别的地方,但需要调整filePath对应的物理路径
String filePath=url;//测试图片物理路径
File file=null;
try{
file=new File(filePath);//要识别的文件路径
}catch(Exception e){
System.out.print(">> 文件加载失败!");
return null;
}
String result = "123";
result=Scan(file2byte(file),filePath.substring(filePath.lastIndexOf(".")+1));//调用网络接口识别
System.out.print(result);//打印出识别结果
java.util.regex.Pattern p1 = java.util.regex.Pattern.compile("<name[^>]*>([^<]*)</name>");
Matcher m1 = p1.matcher(result);
String m1s = null;
while(m1.find()) {
m1s = m1.group(1);
System.out.println(m1.group(1));
}
java.util.regex.Pattern p2 = java.util.regex.Pattern.compile("<cardno[^>]*>([^<]*)</cardno>");
Matcher m2 = p2.matcher(result);
String m2s =null;
while(m2.find()) {
m2s = m2.group(1) ;
System.out.println(m2s);
}
System.out.println(">> end demo.");
String[] strs = {m1s,m2s};
return strs;
}
示例2: addInstructionList
import com.sun.org.apache.xalan.internal.xsltc.compiler.Pattern; //导入依赖的package包/类
/**
* Add a pre-compiled pattern to this mode.
*/
public void addInstructionList(Pattern pattern, InstructionList ilist) {
_preCompiled.put(pattern, ilist);
}
示例3: getInstructionList
import com.sun.org.apache.xalan.internal.xsltc.compiler.Pattern; //导入依赖的package包/类
/**
* Get the instruction list for a pre-compiled pattern. Used by
* test sequences to avoid compiling patterns more than once.
*/
public InstructionList getInstructionList(Pattern pattern) {
return (InstructionList) _preCompiled.get(pattern);
}
示例4: getInstructionList
import com.sun.org.apache.xalan.internal.xsltc.compiler.Pattern; //导入依赖的package包/类
/**
* Get the instruction list for a pre-compiled pattern. Used by
* test sequences to avoid compiling patterns more than once.
*/
public InstructionList getInstructionList(Pattern pattern) {
return _preCompiled.get(pattern);
}