0
我想找到一些共同的html標籤內/屬性正則表達式來找到標籤/屬性是HTML代碼
<a href="xyz">this is an example of an href</a>
我想找到的「href」的第一個實例,因爲它是HTML代碼中使用,但不是第二個實例,因爲它只是html。
我可以嘗試在「< ...>」分隔符內尋找代碼,但有兩個問題,大多數瀏覽器將允許'<',即使它應該是「GT」。
the letter A is < than the letter B
或
<a name="24 is > than 12">this is an example of an href</a>
這樣我就可以放心地我找裏面的HTML屬性,即使它並不總是100%使用正則表達式格式正確的代碼?
請記住這一點http://stackoverflow.com/questions/590747/using-regular-expressions-to-parse-html-why-not – deW1
我不_尋找一個html解析器,我只想尋找一個單詞「href」,並告訴它是否在html標籤中使用,或者它是否僅用作文本。 – FFMG
也看到這個答案http://stackoverflow.com/a/1732454/597607 –