首页 > 代码库 > java 正则表达式抽取

java 正则表达式抽取

package com.achun.test;

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

public class T2 {

public static void main(String[] args) {
String Regex="_(\\d*)=";
String TestStr="contact_name_399=\"鍚屼簨涓嶅叧宸遍珮楂樻寕璧?\"";
String tt = "contac_name_399=";
Pattern p=Pattern.compile(Regex);
Matcher matcher=p.matcher(TestStr);
if (matcher.find()) {
String s = matcher.group(1);
System.out.println(s);
}
}
}