in reply to Pattern Matching - a Tricky one
I'd suggest matching after the unique id...
This works, but is oogly.
#!/usr/bin/perl @chumptastic = <DATA>; $chumpstain = join "\n", @chumptastic; $chumpstain =~ m/bakjob2_details .+? credit .+? # The ? makes these minimal matches; # thus catching the nearest match. customer2\ =\ (-?\d+\.?\d*),/sx; # Modified s to treat it as one string # (. matches newlines) print "$1\n"; __DATA__ # Your Data goes here
Compressed, the regex looks like this: /bakjob2_details.+?credit.+?customer2 = (-?\d+\.?\d*),/s
|
|---|