Skip to content

Commit 129b872

Browse files
committed
regex example to replace all html tags is added
1 parent 6617bbd commit 129b872

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.eprogrammerz.examples.general.regexexample;
2+
3+
/**
4+
* Created by 542596 on 3/9/2017.
5+
*/
6+
public class HtmlTagRegexExample {
7+
public static void main(String[] args) {
8+
String htmlString = "<prs>contents</pr>";
9+
String tagRemovedString = htmlString.replaceAll("<[A-Za-z]+>|</[A-Za-z]+>","");
10+
System.out.println(tagRemovedString);
11+
12+
//you can not compare with null in either parameter
13+
System.out.println("yogen".compareToIgnoreCase(null));
14+
}
15+
}

0 commit comments

Comments
 (0)