JS regularly matches the Filter HTML tag

due to the demand business scenario, there is such a situation:

the background API returns a string with a HTML tag. How to remove the HTML tag with regular matching or a more convenient method at the front end can get the normal value: vivo X21

eg:
v ivo X21
v I vo X21
vi vo X21
vivo X21

The desired effect of

is that no matter where the tag appears, it can be dropped by Filter directly. Please ask the passing boss to give us some advice, thank you ~

Feb.09,2022

regular is fine

'<span>vi</span>vo X21'.replace(/<\/?[^>]+>/g, '');

use v-html if you are using vue, or the js regular expression is: / <\ /?. +?\ /? > / g

Menu