こんにちは、このようなjavascriptの文字列ソリューションを置き換えたいと思います。JavaScriptを<title>に置き換えます。<span>タイトル</span>
input:- this is <title> and <heading>
output:- this is <span>title</span> and <span>heading</span>
誰でも私にこれを助けることができます。 ありがとうございます。 1つの以上の非>
文字が続く、開口部<
と一致し、ある
var input = "this is <title> and <heading>";
var output = input.replace(/<([^>]+)>/g, "<span>$1</span>");
console.log(output);
:このような何かを試してみてください
input.replace(/</g, '<span_').replace(/>/g,'</span>').replace(/_/g,'>');
あなたはJSを経由して、それを達成したいですか? –
文字列を解析する必要がありますタイトルの使用を検索する必要があります 'includes' –