I have a regex problem that i cant figure out.
I need to get the following paragraph out of a file.
First i get that account number then i get the paragraph.
Question : How do i get the full paragraph skipping the cr and lf (\r\n)? Code
Outputuse strict; use warnings; use Data::Dumper; my $self = {}; while (my $line = <DATA>) { if( $line =~ /ACCOUNT\s+NUMBER\s+(\d+)/ ){ $self->{ACCOUNTNUMBER} = $1; print "$1 \n"; }elsif ($line =~ /^(YOUR[\s\w]+)(\d+\.\d+)(.*)/sm ){ print "$1 $2 $3 \n"; } } __DATA__ ACCOUNT NUMBER 000111111111 YOUR LOAN PAYMENT FOR THE YEAR WILL BE 00.00 OF WHICH 00.00 WILL BE FOR PRINCIPAL AND INTEREST, 00.00 WILL GO ESCROW ACCOUNT, AND .00 WILL BE FOR DISCRETIONARY ITEMS THAT YOU CHOSE TO BE INCLUDED WITH YOUR LOAN PAYMENT. THE EFFECTIVE DATE OF YOUR NEW SCHEDULED PAYMENT IS 00/00/00.
000111111111 YOUR LOAN PAYMENT FOR THE COMING YEAR WILL BE 0 0.00
In reply to regex : get a paragraph, not just line by crusty_collins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |