未完成的代码

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

public class Main {
    public static void main(String[] args) {
        String result1 = null;
        String result2 = null;

        String input = "〖HT5SS〗〖JP3〗\uE008【〖CX2〗〖CT〗哀梨蒸食〖CX〗】〖HT〗〖WTXT〗〖JP〗\uE009〖KG*2〗〖CT(〗āi〖CT)〗 lí zhēnɡ shí〖KG*2〗〖HT8.25,8.5SS〗〖JP5〗〖HT8.5,8.75K〗〖CS%100,0,0,0〗哀梨:哀家梨。传说汉代秣陵(今南京)哀仲家种的梨,个儿大味美。把新鲜的哀梨蒸了吃。比喻不识货,将好东西糟蹋了。〖CS〗〖HT8.25,8.5SS〗语本《世说新语·轻诋》:“桓南郡(玄)每见人不快,辄嗔云:‘君得哀家梨,当复不烝(蒸)食不?’”〖CS〗〖HT8.25,8.5SS〗清·郑炎《趪趪猛虡歌》:“庵罗之果不易得,哀梨蒸食伤嘉蔬。”〖HT8.5,8.75K〗〖CS%100,0,0,0〗也作“蒸食哀梨”。〖CS〗〖HT8.25,8.5SS〗\uE008宋·\uE009陆游《齿痛有感》诗:“暮年渐解人间事,蒸食哀梨亦自奇。”清·李调元《蒸梨二绝戏何体斋》:“凭君寄语征南道,蒸食哀梨竟有人。”〖CS〗〖HT8.25,8.5SS〗";
        String regStr1 = "【〖CX2〗〖CT〗(.*?)〖CX〗】〖HT〗〖WTXT〗〖JP〗";
        String regStr2 = "\uE009〖KG\\*2〗(.*?)〖KG\\*2〗";
        String regStr3="^[〖HT8.25,8.5SS〗]"
        //提取成语
        Pattern pattern = Pattern.compile(regStr1);
        Matcher matcher = pattern.matcher(input);
        if (matcher.find())  result1 = matcher.group(1);
        //提取拼音
        pattern = Pattern.compile(regStr2);
        matcher = pattern.matcher(input);
        if (matcher.find())  result2 = matcher.group(1);
        //System.out.println(result2);


    }
}

你可能感兴趣的:(XML,xml)