in reply to Regular expression

Corion and shmem have both suggested an approach using a split on whitespace. You would need to take precautions if the path can include spaces. This can be done by isolating the path field using three-argument splits from either end of the record.

use strict; use warnings; my @records = ( qq{FRAG 1 1 2000000 0 0 0 0 \\\\172.20.13.49\\backup\\rbgmst02_dd2\ +\stu1\\CPOSTA_1221170039_C1_F1 rbgmst02 65536 0 0 -1 0 *NULL* 1222379 +639 1 65537 0 0 0 0 0 0 0}, qq{FRAG 1 1 2000000 0 0 0 0 \\\\172.20.13.49\\backup\\rbgmst02_dd2\ +\New Folder\\Space File rbgmst02 65536 0 0 -1 0 *NULL* 1222379639 1 6 +5537 0 0 0 0 0 0 0}, ); foreach my $record ( @records ) { my @leftFields = split m{\s+}, $record, 9; my $path = ( reverse map { $_ = reverse } split m{\s+}, reverse( $leftFields[ 8 ] ), 18 )[ 0 ]; my $basename = ( split m{\\}, $path )[ -1 ]; print qq{$path\n $basename\n}; }

The output,

\\172.20.13.49\backup\rbgmst02_dd2\stu1\CPOSTA_1221170039_C1_F1 CPOSTA_1221170039_C1_F1 \\172.20.13.49\backup\rbgmst02_dd2\New Folder\Space File Space File

I hope this is of interest.

Cheers,

JohnGG