62,623
社区成员
发帖
与我相关
我的任务
分享 try
{
String str = "<a>sdfa<b>s<br/>df<a><form><a/></form>xxxx<br/><b>";
str = str.replaceAll("</?[^>]+?(?<!br/?)>","");
System.out.println(str);
}
catch (Exception e)
{
e.printStackTrace();
} public static void main(String[] args)
{
String s = "http://item.slide.com/r/1/157/.jpg http://item.slide.com/r/1/217/i/ http://item.slide.com/r/1/157/.jpg ";
Pattern p = Pattern.compile("(http://*(?:(?!.jpg).)*?)\\s");
Matcher m = p.matcher(s);
m.matches();
while(m.find())
{
System.out.print(" "+m.group(1));
}
}import java.util.regex.*;
public class test
{
public static void main(String[] args)
{
String s = "http://item.slide.com/r/1/157/.jpg http://item.slide.com/r/1/217/i/ http://item.slide.com/r/1/157/.jpg ";
Pattern p = Pattern.compile("http://[^\\s]+?(?<!\\.jpg)(?=\\s*http://|$|\\s+)");
Matcher m = p.matcher(s);
while(m.find())
{
System.out.println(m.group());
}
}
}import java.util.regex.*;
public class Main {
public static void main(String[] args) {
try {
String str = "http://item.slide.com/r/1/123/i/ http://item.slide.com/r/1/217/i/ http://item.slide.com/r/1/157/";
Pattern pat = Pattern.compile("http://(?!.*http://.*).+?$");
Matcher mat = pat.matcher(str);
while (mat.find())
{
System.out.println(mat.group());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}