Alex Alex - 5 months ago 40
Perl Question

Perl regex first word

I am very new to regex in perl and I have the following line:

MD5ajdhe728ndsdhsds83ndsds /some/path/

and I just want to get the MD5 value (the number/letter combination after "MD5"). How do I do that? I have kind of troubles fetching the first word.

Thank you in advance.

use strict;
use warnings;
my $line = q{MD5ajdhe728ndsdhsds83ndsds /some/path/};
$line =~ /^MD5([a-zA-Z0-9]+)/;
print $1;