Your Regex Brain

Peter J. Holzer hjp-usenet2 at hjp.at
Tue Mar 27 14:40:34 CEST 2012


["Followup-To:" header set to comp.lang.perl.misc.]
On 2012-03-27 00:02, sln at netherlands.com <sln at netherlands.com> wrote:
> 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+ (?:".*?"|\'.*?\'|[^>]*?)+ > ) (?<!/>)
> '

"This is your brain on drugs."

    SCNR,
    	hp


-- 
   _  | Peter J. Holzer    | Deprecating human carelessness and
|_|_) | Sysadmin WSR       | ignorance has no successful track record.
| |   | hjp at hjp.at         | 
__/   | http://www.hjp.at/ |  -- Bill Code on asrg at irtf.org



More information about the Python-list mailing list