Google と stackoverflow で検索しましたが、良い答えが見つかりませんでした。私も自分で試してみましたが、正規表現の達人ではありません。
私の目標は、html スタイル タグ内のすべての相対 URL を絶対バージョンに置き換えることです。
例えば
style="url(/test.png)"
とstyle="url(http://mysite.com/test.png)"
style="url("/test.png")"
とstyle="url("http://mysite.com/test.png")"
style="url('/test.png')"
とstyle="url('http://mysite.com/test.png')"
style="url(../test.png)"
とstyle="url(http://mysite.com/test.png)"
style="url("../test.png")"
とstyle="url('http://mysite.com/test.png')"
style="url('../test.png')"
とstyle="url('http://mysite.com/test.png')"
等々。
ここで、貧弱な正規表現「スキル」で試したこと
url\((?<Url>[^\)]*)\)
「url」関数でURLを教えてくれます。
前もって感謝します!