-4

テキスト ファイルと html ファイルを一致させる正規表現が必要です。

"<b>Dog</b> and Cat"

これは次のようになります

"Dog and Cat"

私はJavaを使用しています。

4

1 に答える 1

0

Below is the code segment you will need.

String text, html;
BufferedReader br;
int i;int tags=0;

br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter HTML code");//If you want to read ferom file, replace the code
html=br.readLine();
for(i=0;i<html.length();i++){
if(html.charAt(i)=='<'){tags++;continue;}
if(html.charAt(i)=='>'){tags--;continue;}
if(tags==0)text=text+html.charAt(i);
}
于 2013-01-15T05:00:24.710 に答える