in reply to Re^2: Selecting HL7 Transactions
in thread Selecting HL7 Transactions
"The parentheses are used for the repeat factor. All my research on the internet indicates a multi-character pattern that needs to be repeated multiple times should be enclosed in parentheses. Is this not correct?"
Here's a test showing clustering and capturing. Both match as expected. Capturing also sets $1.
$ perl -Mstrict -Mwarnings -E ' my $re1 = qr{PV1\|1\|O\|(?:[^|]*\|){3}\|}; my $re2 = qr{PV1\|1\|O\|([^|]*\|){3}\|}; my $x = q{PV1|1|O|F3|F4|F5|F6|F7}; my $y = q{PV1|1|O|F3|F4|F5||F7}; say "------- Clustering -------"; say "Match in \$x" if $x =~ /$re1/; say $1 if $1; say "Match in \$y" if $y =~ /$re1/; say $1 if $1; say "------- Capturing -------"; say "Match in \$x" if $x =~ /$re2/; say $1 if $1; say "Match in \$y" if $y =~ /$re2/; say $1 if $1; ' ------- Clustering ------- Match in $y ------- Capturing ------- Match in $y F5|
-- Ken
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Selecting HL7 Transactions
by BillDowns (Novice) on May 02, 2013 at 01:02 UTC | |
by kcott (Archbishop) on May 02, 2013 at 02:41 UTC | |
by BillDowns (Novice) on May 02, 2013 at 03:07 UTC | |
by Anonymous Monk on May 02, 2013 at 03:25 UTC | |
Re^4: Selecting HL7 Transactions
by Anonymous Monk on May 02, 2013 at 00:46 UTC | |
by BillDowns (Novice) on May 02, 2013 at 00:48 UTC |
In Section
Seekers of Perl Wisdom