fairworld's life

자바에서 정규식으로 html 태그 제거 본문

Computer Life/Programming Life

자바에서 정규식으로 html 태그 제거

fairworld 2008. 5. 30. 10:41

// 정규표현식으로 제거
 String.replaceAll("<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>","");


 // 한줄로 할려면 아래 추가
 String.replaceAll("("\r|\n|&nbsp;","");
            


.replaceAll("<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>","").replaceAll("\r|\n|&nbsp;","")