in reply to Re^2: Prove me wrong,...please (yet more regex blues).
in thread Prove me wrong,...please (yet more regex blues).
Your choices of landmarks to match seem unlikely as the key determiners for the desired information. What if other lines are included (now or in the future) with similar formats that have leading spaces or equal signs? I would more likely guess that the keywords and string-delimited labels are the important parts to watch.
Literate code helps the maintenance programmer (or yourself) figure out how it works later.
As you and your team of maintainers get more familiar with regular expressions, you may tighten that up with less spacing and less commentary, but the pattern is specific and includes the obvious visual landmarks which are important for the programmer to understand.while (<DATA>) { next if not /^ \s* vsan \s+ (\d+) \s+ # $1 name \s+ ( \" .*? \" ) # $2 $ /x; print "vsan $1 = $2\n"; }
--
[ e d @ h a l l e y . c c ]
|
|---|