私はこのようなサンプル文字列を持っていました。RegExは、javascriptを使用してhtmlコンテンツ文字列の間に英語テキストを抽出します
私はJavaScriptで英語のテキストを抽出する正規表現を必要とする<br> My first word, sentence
<div class='test'><span class='abc'></span>
</div> <br>between 1185–1667 <div> my second sentence, 1223 <span>some nested text 123</span></div>
<span> my third word, asdf 1234 and fourth word</span>
、この
var result=[
"My first word, sentence",
"between",
"my second sentence",
"some nested text",
"my third word, asdf",
"and fourth word"
]
ようになり、結果が
そして、何あなたがネストされた要素を見つけた場合は? –
こんにちは、順番に英語のテキストを抽出するだけで、ネストされた要素シーケンスは必要ありません。最後の文字列は左から右へ - 質問で更新されました。 – Kiran
@Kiran JavaScriptの正規表現はそのタスクには十分強力ではありません。 –