アンカータグのhref属性が空白の場合、アンカータグの値をアンカーのタイトル値で置き換えようとしています。hrefの値が正規表現で空の場合、アンカータグの値をアンカータイトルに置き換えます。
<a xlink:href="">Lorem Ipsum</a> is simply dummy text of the printing and typesetting industry<a xlink:href ="http://google.com">Google</a>.
同様
私は正規表現の下にしようとした場合:
<a [^>]+>(.*?)<\/a>
その後、私はそれを交換
Lorem Ipsum is simply dummy text of the printing and typesetting industry Google.
の下に取得しています出力Anchor Text値を持つアンカータグと、href属性値が空のアンカータグを置き換える必要があります。
私は
Lorem Ipsum is simply dummy text of the printing and typesetting industry<a xlink:href ="http://google.com">Google</a>
これは役に立ちますか? '(。*?)<\/a>' – Ramesh
Nope @rameshまた、正規表現のテストリンクを追加しました。ありがとうございました –
https://stackoverflow.com/a/17004406/2064981 – ClasG