lola
lola

Reputation: 5789

ignore some strings with MATLAB

I would like to extract some text contained in HTML tags. For example:

<html><body>this is a warning message. wrongs values</body></html>

the result should get the message by ignoring all HTML tags.

Does anyone have any suggestion?

Upvotes: 0

Views: 447

Answers (2)

Amro
Amro

Reputation: 124563

You can strip HTML tags using regular expressions:

str = '<html><body>this is a warning message. wrongs values</body></html>';
str2 = regexprep(str, '<[^>]*>', '')

Upvotes: 1

carlosdc
carlosdc

Reputation: 12142

You want something like this:

 a = sscanf('<html><body>this is a warning message. wrongs values</body></html>','<html><body>%[a-zA-Z., ]</body></html>')

Upvotes: 1

Related Questions