Hello Dermot, Wednesday, December 05, 2001, Dermot Paikkos <[EMAIL PROTECTED]> wrote:
DP> Hi there, DP> This is both frustrating and embarrassing. I can't capture the DP> following data into a variable. The line I want is: DP> <DL.COD>GIAZUC00</DL.COD> DP> I have tried a multitude of Regex, none seems to be working. Here's DP> my last attempt: DP> open(F,"$i"); DP> while (defined( $p = <F>)) { DP> chomp($p); DP> ($code) = ( $p =~ /^\<DL\.COD\>(\w\d+)/ ); DP> } DP> print "$code\t $i\n"; DP> Most of my attempts have been trying to Esc the "<", but I am not DP> sure these are metacharacters. you don't need to escape '<' and '>' symbols in regexps. your regexp should looks like ($code) = ( $p =~ /^<DL\.COD>(\w+)/ ); , if you want to store 'GIAZUC00' into $code. \w is [a-zA-Z0-9_] if you want to separate letters and digits, you need something like this: ($code,$num) = ( $p =~ /^<DL\.COD>([a-zA-Z]+)(\d+)/ ); Best wishes, Maxim mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]