Trying to use Replace to change the output of value on a view using custom text I'm trying to figure out how I can replace underscores and a specific text using Replace on a Drupal 8 view custom text. In a template, I could use the following code to replace specific text.

&lt;span class="tag"&gt;{{ items.entity.getType|replace({'_': " ", "2": ""}) }}&lt;/span&gt;


what can I use on a view on custom text? I tried using {{ type|replace({'_': " ", "2": ""}) }} but it seems to show the text as plain text, not HTML markup.
have you try to use Rewrite results in views field settings? In Rewrite results there is an option Override the output of this field with custom text if you click on it it will let you change the output of this field to whatever you want.
plus there will be a Replacement patterns option which will show you a list of replacement tokens. also you can add some HTML if you want/need to.