Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a><b><![CDATA[userinput]></b><c>text of c</c><d></d><e>text of e</e></a>
- Pattern pattern = Pattern.compile("<b>.*?</b>", Pattern.DOTALL | Pattern.UNICODE_CASE | Pattern.MULTILINE);
- Matcher matcher = pattern.matcher(input);
- StringBuilder builder = new StringBuilder();
- int lastIndex = 0;
- while (matcher.find()) {
- builder.append(input.substring(lastIndex, matcher.start()));
- lastIndex = matcher.end();
- }
- builder.append(input.substring(lastIndex));
- <a><b><![CDATA[test 123 </b><c>inside</c>]></b><c>outside</c><d></d><e>out side</e></a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement