私は以下のような文字列を持っています
case1:
str = "type=\"text/xsl\" href=\"http://skdjf.sdjhshf/CDA0000=.xsl\""
case2:
str = "href=\"http://skdjf.sdjhshf/CDA0000=.xsl\" type=\"text/xsl\""
次のような値を抽出する必要があります
type -> text/xsl
href -> http://skdjf.sdjhshf/CDA0000=.xsl
これが失敗する私の正規表現です。
str.match(/type="(.*)"/)[1]
#this works in second case
=>"text/xsl"
str.match(/http="(.*)"/)[1]
#this works in first case
=>"http://skdjf.sdjhshf/CDA0000=.xsl"
失敗した場合、文字列全体が一致します。
何か案が?