Regex for html attributes in php

前端 未结 2 711
谎友^
谎友^ 2021-01-26 02:23

I am trying to parse a string of HTML tag attributes in php. There can be 3 cases:

attribute=\"value\"  //inside the quotes there can be everything also other es         


        
2条回答
  •  走了就别回头了
    2021-01-26 03:15

    Never ever use regular expressions for processing html, especially if you're writing a library and don't know what your input will look like. Take a look at simplexml, for example.

提交回复
热议问题