in reply to regexp match repetition breaks in Perl
use strict; use warnings; my $text = <<'TEXT'; Those APCs are APC 282, 376, 377 and 398. The APC assignments are also + shown in attachment K1. In the Final Rule, we indicated that clinica +l characteristics and expected resource use. Procedures are sufficie +ntly similar to those other procedures assigned to APC 282, 376, 377, + and 398, and that we believe those APC assignments were appropriate. + Specifically APCs 662 and APC 282. As shown in attachment K3 under o +ption number 1, to be placed in APC 662. Our data analysis shows that + combining services currently assigned to APC 662 would result in an +APC median cost of about 302. The 6 CPT-Codes that would go into APC +662 are: CPT-Codes 0145T through 0150T. The two other cardiac CT code +s, specifically 0144T and 0151T would be assigned to APC 282. The inc +lusion of the two codes into APC 282 would result in... TEXT my $rxExtract = qr {(?x) (?: (?<=APC) | (?<=APCs) | (?<=,) | (?<=and) ) \s(\d{3})(?:\D|\z) }; my @extracts = $text =~ m{$rxExtract}g; print qq{Match $_: $extracts[$_]\n} for 0 .. $#extracts;
The output is
Match 0: 282 Match 1: 376 Match 2: 377 Match 3: 398 Match 4: 282 Match 5: 376 Match 6: 377 Match 7: 398 Match 8: 662 Match 9: 282 Match 10: 662 Match 11: 662 Match 12: 662 Match 13: 282 Match 14: 282
I hope this is of use.
Cheers,
JohnGG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regexp match repetition breaks in Perl
by ikegami (Patriarch) on Jul 11, 2007 at 14:10 UTC | |
by johngg (Canon) on Jul 11, 2007 at 15:26 UTC | |
by ikegami (Patriarch) on Jul 11, 2007 at 15:34 UTC |