RegEx for extracting HTML Image properties

前端 未结 6 1440
走了就别回头了
走了就别回头了 2021-01-28 12:02

I need a RegEx pattern for extracting all the properties of an image tag.

As we all know, there are lots of malformed HTML out there, so the pattern has to cover those p

6条回答
  •  北海茫月
    2021-01-28 13:02

    If you want all attribute values, might I suggest using the DOM? Something like element.attributes will work well.

    If you insist on a regex //\b\w+="[^"]+"// should get everything.

提交回复
热议问题