There are times when you need to send long description to external system. But the problem occurs when the Long Description is rich text enabled and contains html tags. Below script uses regular expression to remove the HTML tags.
print ("***********Start of the Script************") from java.util.regex import Pattern item_long = mbo.getString("DESCRIPTION_LONGDESCRIPTION") print (item_long) match_v1 = Pattern.compile('\\<.*?\\>').matcher(item_long).replaceAll('') print (match_v1) print ("************End of the Script**************")
Result
**********Start of the Script************ <div>dasdasd</div><div>sdasd </div><div>asdasd </div><div>asdasdasd </div><div>sdasdas <br /></div><!-- RICH TEXT --> dasdasdsdasd asdasd asdasdasd sdasdas ************End of the Script**************