正则表达式的匹配

(object State "结束" quid "49AE12B0005D" type "EndState") (object State "开始" quid "49AE12B1034B" type "StartState") (object State "状态1" quid "49AE12B601E4" type "Normal") (object State "状态2" quid "49AE12B80203" type "Normal")这样的字符用正则怎么提取里面的 结束,状态1,开始,状态2 呢?

整个输入的字符串就是:
[code="java"]String str = "(object State "结束" quid "49AE12B0005D" type "EndState") (object State "开始" quid "49AE12B1034B" type "StartState") (object State "状态1" quid "49AE12B601E4" type "Normal") (object State "状态2" quid "49AE12B80203" type "Normal")"[/code]
这样么?中间有没有换行符?原始输入有没有带某些特定格式?

如果输入就是像上面那样的话那好办,这样:
[code="java"]import java.util.regex.*;

public class Test {
public static void main(String[] args) {
String str = "(object State \"结束\" quid \"49AE12B0005D\" type \"EndState\") (object State \"开始\" quid \"49AE12B1034B\" type \"StartState\") (object State \"状态1\" quid \"49AE12B601E4\" type \"Normal\") (object State \"状态2\" quid \"49AE12B80203\" type \"Normal\")";
Pattern p = Pattern.compile("\(object\s+State\s+\"(.+?)\"");
Matcher m = p.matcher(str);

    while (m.find()) {
        System.out.println(m.group(1));
    }
}

}

// 输出:
// 结束
// 开始
// 状态1
// 状态2[/code]

(object State "结束" quid "49AE12B0005D" type "EndState")

(object State "开始" quid "49AE12B1034B" type "StartState")

(object State "状态1" quid "49AE12B601E4" type "Normal") (object State "状态2" quid "49AE12B80203" type "Normal")

是java语言?还是JavaScript?

如果是Java而且,你前后左右的文字都是固定的话,那提取很简单。

String regex = "\(object State "(.*?)" quid";

然后获取group(1)就可以了。