PageMonitor Regex?

问题描述 投票:0回答:1

如何在此处使用PageMonitor Regex扩展程序https://chrome.google.com/webstore/detail/page-monitor/ogeebjpdeabhncjpfhgdibjajcajepgg检查网页上图像的任何更改,或者网页上是否有新图像?

我相信我可以用正则表达式来做,但我不太确定

<img src="//a.thumbs.redditmedia.com/IfVRE-
Cq7BWXAly4GHbPJrTh5GjQgh6iC01RspCa8I0.jpg" width="70" height="52" alt="" 
class="hoverZoomLink">

假设我有那个代码,如果对“IfVRE- Cq7BWXAly4GHbPJrTh5GjQgh6iC01RspCa8I0.jpg”有任何更改,我希望pagemonitor通知我..我该怎么做?

regex expression monitor
1个回答
-1
投票

应该很容易,拿这个刮刀旋转..

/<img(?=(?:[^>"']|"[^"]*"|'[^']*')*?\ssrc\s*=\s*(?:(['"])\s*\/\/a\.thumbs\.redditmedia\.com\/IfVRE-\s*((?:(?!\1)[\S\s])*?)\.jpg\s*\1))\s+(?:"[\S\s]*?"|'[\S\s]*?'|[^>]*?)+>/

https://regex101.com/r/ozHaof/1

 < img                                 # 'img' tag

 (?=                                   # Asserttion (a pseudo atomic group)
      (?: [^>"'] | " [^"]* " | ' [^']* ' )*?
      \s src \s* = \s*                      # Monitor 'src' attribute for changes
      (?:
           ( ['"] )                              # (1), Quote
           \s* 
           //a\.thumbs\.redditmedia\.com/IfVRE-  # Monitor src value that starts with this
           \s* 
           (                                     # (2 start), What the jpg changed to
                (?:
                     (?! \1 )
                     [\S\s] 
                )*?
           )                                     # (2 end)
           \.jpg \s*                             # Up to to .jpg
           \1 
      )
 )
 \s+ 
 (?: " [\S\s]*? " | ' [\S\s]*? ' | [^>]*? )+
 >
© www.soinside.com 2019 - 2024. All rights reserved.