On Sat, 24 Mar 2012 16:30:28 -0700 (PDT), Xah Lee <xah...@gmail.com> wrote:

>?Your Regex Brain?
>http://xahlee.org/comp/your_regex_brain.html
>

That's more like a brain cell.
This is more like a regex brain.

'
<img 
  (?=\s) 
  (?= (?:[^>"\']|"[^"]*"|\'[^\']*\')*? (?<=\s) width \s*=
      (?: (?> \s* ([\'"]) \s* (?<WIDTH>.*?) \s* \g{-2} )
        | (?> (?!\s*[\'"]) \s* (?<WIDTH>[^\s>]*) (?=\s|>) )   
      )
  )
  (?= (?:[^>"\']|"[^"]*"|\'[^\']*\')*? (?<=\s) src \s*=
      (?: (?> \s* ([\'"]) \s* (?<SRC>.*?) \s* \g{-2} )
        | (?> (?!\s*[\'"]) \s* (?<SRC>[^\s>]*) (?=\s|>) )   
      )
  )
  (?= (?:[^>"\']|"[^"]*"|\'[^\']*\')*? (?<=\s) height \s*=
      (?: (?> \s* ([\'"]) \s* (?<HEIGHT>.*?) \s* \g{-2} )
        | (?> (?!\s*[\'"]) \s* (?<HEIGHT>[^\s>]*) (?=\s|>) )   
      )
  )
  (?= (?:[^>"\']|"[^"]*"|\'[^\']*\')*? (?<=\s) alt \s*=
      (?: (?> \s* ([\'"]) \s* (?<ALT>.*?) \s* \g{-2} )
        | (?> (?!\s*[\'"]) \s* (?<ALT>[^\s>]*) (?=\s|>) )   
      )
  )
  (?> \s+ (?:".*?"|\'.*?\'|[^>]*?)+ > ) (?<!/>)
'

-sln

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to