[Vienna-pm] Suchen nach Begriffen innerhalb strukturierter Da tei

Christian Schoeller c_p_s at gmx.net
Wed Jan 7 09:51:24 CST 2004


On Wed, Jan 07, 2004 at 04:15:01PM +0100, LAUN Wolfgang wrote:
[RegExps im Listenkontext]
> Im Prinzip sieht das etwa so aus:
> 
>    my $lines = join( '', <DB> );

Hiermit habe ich noch keine Probleme.

>    my @res = $lines =~ /\G($PATTERN)/gs;  # list context !
			   ^
Nachdem ich diesen Modifier noch nicht kannte, habe ich in perlop
nachgelesen: 

# You can intermix `m//g' matches with `m/\G.../g', where `\G' is
# a zero-width assertion that matches the exact position where
# the previous `m//g', if any, left off.

Ich habe allerdings keine Ahnung, inwieweit das in meinem Fall
Bedeutung hat. Maybe I simply miss the point.

Danke allerdings fuer den Hinweis auf die Verwendung von RegExps im
Listenkontext - diese Moeglichkeit kannte ich bisher nicht und
erscheint mir sehr interessant. Allerdings sagt perlop dazu:

# If the `/g' option is not used, `m//' in list context returns a
# list consisting of the subexpressions matched by the parenthe-
# ses in the pattern, i.e., (`$1', `$2', `$3'...).

Wie korreliert diese Anmerkung damit, dass du IMHO exakt oben
beschriebenes Verhalten erwartest, allerdings _trotzdem_ /g
verwendest? 

LG,
	C.

-- 
Christian Schoeller {Student}  | "It's easy to find something
MAIL {mailto:c_p_s at gmx.net}    | worth dying for. Do you have
HTTP {http://www.yaup.at.tt}   | anything worth living for?"
EBAY {c_p_s!}                  | --Lorien (Babylon 5)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/vienna-pm/attachments/20040107/ae859f08/attachment.bin


More information about the Vienna-pm mailing list