in reply to How to find a string after matching a Keyword

You don't need assertions to match a string next to a string
#!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd /; my $data = q{ This is CentOs 6.5 version and CentOs 5.5 is not supported. The CentOS 6.0 has ability for LVM Snap backups where as CentOs 5.5 do +esn't.}; my @centos = $data =~ /CentOs\s+(\S+)/g; dd( \@centos ); __END__ [6.5, 5.5, 5.5]