Rudif has asked for the wisdom of the Perl Monks concerning the following question:
#! perl -w use strict; my $text; { $/ = undef; $text = <DATA>; } my @f = split /(?<=\n)([ \t]*[\[\]][ \t]*\n)/s, $text; OUTER: for my $i (0..$#f-2) { { # inner block 1 next OUTER unless $f[$i] =~ /^([ \t]*[\[][ \t]*)\n$/ && $f[$i+2] =~ /^([ \t]*[\]][ \t]*)\n$/ && $f[$i+3] =~ /((?:disp)?interface\s+\w+)/; print STDERR "==$i== $1\n"; } { # inner block 2 $f[$i+1] =~ /(?<=\n)((\s*[\/]*\s*not)?\s+hidden)/; my $h = defined $1 ? $1 : ' HIDDEN UNDEF'; print STDERR "==$i== $h\n"; } } __DATA__ [ uuid(078F04FD-B23E-11D3-80C3-00A024D42DAF), // not hidden ] dispinterface _IMgrEvents { }; [ object, uuid(078F04EB-B23E-11D3-80C3-00A024D42DAF), hidden ] interface IMgr : IDispatch { [propget, id(201), HRESULT DebugInfo([out, retval] BSTR *pVal) +; }; [ uuid(078F04FE-B23E-11D3-80C3-00A024D42DAF), ] dispinterface _IMgrEvents { }; [ object, uuid(078F04EC-B23E-11D3-80C3-00A024D42DAF), ] interface IMgr : IDispatch { [propget, id(201), HRESULT DebugInfo([out, retval] BSTR *pVal) +; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Scoping the regex memory variables and where do I go next
by japhy (Canon) on Mar 01, 2001 at 05:07 UTC | |
|
Re: Scoping the regex memory variables and where do I go next
by tadman (Prior) on Mar 01, 2001 at 04:58 UTC | |
|
Re: Scoping the regex memory variables and where do I go next
by Rudif (Hermit) on Mar 01, 2001 at 05:10 UTC | |
by japhy (Canon) on Mar 01, 2001 at 05:20 UTC | |
|
Re: Scoping the regex memory variables and where do I go next
by chipmunk (Parson) on Mar 01, 2001 at 08:38 UTC | |
|
Re: Scoping the regex memory variables and where do I go next
by Rudif (Hermit) on Mar 02, 2001 at 03:34 UTC |