Replace HTML tags in a string

Suppose you want to change "<HTML><B>Sample Text</B></HTML>" to "Sample Text".

Use following function modules.

SOTR_TAGS_REMOVE_FROM_STRING

HRDSYS_CONVERT_FROM_HTML

SWA_STRING_REMOVE_SUBSTRING

 

Other option is to use Regular Expressions.

DATA: message TYPE string.
message = '<p style="something">Hello <strong>World</strong>!</p>'.
REPLACE ALL OCCURRENCES OF REGEX '<[a-zA-Z\/][^>]*>' IN message with space.
WRITE:/ message.