Neighborhoods a regular expression

Category: Web Develop
 
new210
2011-08-20 01:47:35

Sponsored Links
You can only enter the user starts the onclick not contain any other <div> </div>
end must enter the onclick does not contain any other <div> </div>

Only <div> content </div> <div> </div> so that it can properly

seeking a multi-line matches the expression.

Sponsored Links

voboy
2011-08-20 01:50:14
(<div>. +? </div>) +
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Hello {
    public static void main(String[] args) {
        String str = "<div> </div><div>goto</div>";
        System.out.println(str.matches("(<div>.+?</div>)+"));

        Pattern pattern = Pattern.compile("<div>.+?</div>");
        Matcher matcher = pattern.matcher(str);

        while (matcher.find()) {
            System.out.println(matcher.group(0));
        }
    }
}
jiang821214
2011-08-20 02:09:27

+1
chaoswind
2011-08-20 02:28:00

System.out.println (str.matches ("(<div>. +? </div>) +"));
System.out.println (str . matches ("(<div>. *? </div>) +"));
difference between these two is not
<div> </div>
the first one will not pass. The second will pass?
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.