import java.util.regex.*;
class Main
{
public static void main(String[] args)
{
String txt="http://www.youtube.com/v/Ig1WxMI9bxQ&hl=fr&fs=1&color1=0x2b405b&color2=0x6b8ab6";
String re1=".*?"; // Non-greedy match on filler
String re2="(?:[a-z][a-z0-9_]*)"; // Uninteresting: var
String re3=".*?"; // Non-greedy match on filler
String re4="(?:[a-z][a-z0-9_]*)"; // Uninteresting: var
String re5=".*?"; // Non-greedy match on filler
String re6="(?:[a-z][a-z0-9_]*)"; // Uninteresting: var
String re7=".*?"; // Non-greedy match on filler
String re8="(?:[a-z][a-z0-9_]*)"; // Uninteresting: var
String re9=".*?"; // Non-greedy match on filler
String re10="(?:[a-z][a-z0-9_]*)"; // Uninteresting: var
String re11=".*?"; // Non-greedy match on filler
String re12="((?:[a-z][a-z0-9_]*))"; // Variable Name 1
Pattern p = Pattern.compile(re1+re2+re3+re4+re5+re6+re7+re8+re9+re10+re11+re12,Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
Matcher m = p.matcher(txt);
if (m.find())
{
String var1=m.group(1);
System.out.print("("+var1.toString()+")"+"\n");
}
}
}
您可以使用 txt2re.com 来满足您的所有正则表达式需求(:值得检查。没用的,但您当然可以简化您获得的来源。