in reply to pattern matching

Try this simple script for your line:
#!/usr/bin/perl -w use strict; my $line = "0010 0010 text // text // JOHN DOE"; chomp $line; if ($line =~ /^(0010 ){2}(.*\/\/ ){2}(.*)$/) { my $name = $3; }
UPDATE:
Also:
my $name = "0010 0010 text // text // JOHN DOE"; chomp($name); + $name =~ s/^(0010 ){2}(.*\/\/ ){2}(.*)$/$3/i; print $name;

Replies are listed 'Best First'.
Re: Re: pattern matching
by Anomynous Monk (Scribe) on May 04, 2004 at 18:18 UTC
    For the curious, perl reoptimizes (0010 ){2} back into "0010 0010 " when looking for possible places to match (even without the ^).