#!/usr/bin/perl use strict; use warnings; my $string = 'CME.b/ESM8'; if ( $string =~ /^CME\.b?[^\/.]/ ) { print "yes\n"; } else { print "no\n"; }