テキスト内の最後のスペースを見つける正規表現を探していますが、HTML タグ内のスペースを見つけたくありません。
"This is a string with <strong>some</strong> html in it"
正規表現が見つけるべきスペースは、 と の間のスペースin
ですit
。その正規表現はそれほど難しくありません。ここでも同じ正規表現が機能します。
"This is a string with <strong>some</strong> html in <a href="">the end</a>"
スペースは HTML の と の間にthe
なりますend
(OK!)
しかし、私の文字列が次の場合:
"This is a string with <strong>some</strong> html in the <a href="">end</a>"
次に、スペースは と の間the
で<a
はなくと の間にある必要が<a
ありhref="">end<a>
ます。
誰かアイデアはありますか?