Using regular expressions to find img tags without an alt attribute

前端 未结 8 1756
伪装坚强ぢ
伪装坚强ぢ 2021-01-30 11:37

I am going through a large website (1600+ pages) to make it pass Priority 1 W3C WAI. As a result, things like image tags need to have alt attributes.

What would be the

8条回答
  •  鱼传尺愫
    2021-01-30 12:14

    This is perfectly possible with following regEx:

    
    

    Looking for something that isn't there, is rather tricky, but we can trick them back, by looking for a group that doesn't start with 'a', or an 'a' that doesn't get followed by an 'l' and so on.

提交回复
热议问题