求table表格的正则表达式
需要把[table][tr][td]test[/td][/tr][/table]替换成<table><tr><td>test</td></tr></table>
用正则表达式应该怎么做?
盼高手速降!!!
------解决方案--------------------这个也许是你要的。
UBB
String str=st;
str=str.replaceAll("\\[b\\](.*?)\\[/b\\]","<b>$1</b>");
反UBB
String str=st;
str=str.replaceAll("<b>(.*?)</b>","
$1");
------解决方案--------------------//反UBB
public static String getUBB(String st){
if(st==null||st.length()==0){
return st;
}
String str=st;
str=str.replaceAll("<b>(.*?)</b>","
$1");
str=str.replaceAll("<h6>(.*?)</h6>","[h6]$1[/h6]");
str=str.replaceAll("<h5>(.*?)</h5>","[h5]$1[/h5]");
str=str.replaceAll("<h4>(.*?)</h4>","[h4]$1[/h4]");
str=str.replaceAll("<h3>(.*?)</h3>","[h3]$1[/h3]");
str=str.replaceAll("<h2>(.*?)</h2>","[h2]$1[/h2]");
str=str.replaceAll("<h1>(.*?)</h1>","[h1]$1[/h1]");
str=str.replaceAll("<u>(.*?)</u>","$1");
str=str.replaceAll("<i>(.*?)</i>","[en]$1[/en]");
str=str.replaceAll("<font color=black>(.*?)</font>","[black]$1[/black]");
str=str.replaceAll("<font color=white>(.*?)</font>","[white]$1[/white]");
str=str.replaceAll("<font color=red>(.*?)</font>","[red]$1[/red]");
str=str.replaceAll("<font color=pink>(.*?)</font>","[pink]$1[/pink]");
str=str.replaceAll("<font color=blue>(.*?)</font>","[blue]$1[/blue]");
str=str.replaceAll("<font color=green>(.*?)</font>","[green]$1[/green]");
str=str.replaceAll("<font color=olive>(.*?)</font>","[olive]$1[/olive]");
str=str.replaceAll("<font color=navy>(.*?)</font>","[navy]$1[/navy]");
str=str.replaceAll("<font color=gray>(.*?)</font>","[gray]$1[/gray]");
str=str.replaceAll("<font color=fuchsia>(.*?)</font>","[fuchsia]$1[/fuchsia]");
str=str.replaceAll("<font color=yellow>(.*?)</font>","[yellow]$1[/yellow]");
str=str.replaceAll("<font color=silver>(.*?)</font>","[silver]$1[/silver]");
str=str.replaceAll("<font color=purple>(.*?)</font>","[purple]$1[/purple]");
str=str.replaceAll("<a href=(.*?)><font color=#FF0000><strong><u>(.*?)</u></font></strong></a>","$2");
str=str.replaceAll("<IMG src=(.*?) border=0>","[img]$1[/img]");
str=str.replaceAll("<marquee scrollamount=3>(.*?)</marquee>","[marquee]$1[/marquee]");
return str;
}