Hello all.
I have a small problem, the next code finds the neden content, but it doenst print it:

$string = "#324423asdd asd 'BecamePosters' ";
if($string =~ m/'[a-zA-Z]{1,40}'/) {
print "ok!\n";
print $1;
} else {
print "not ok!\n";
}

It only prints "ok!\n" but nothing more.
Also triyed m/'*'/ but i get the same result, any sujestions ?

Recommended Answers

All 2 Replies

#!/usr/bin/perl -w
use strict;
my $string = "#324423asdd asd 'BecamePosters' ";
if($string =~ m/('[a-zA-Z]{1,40}')/) { #Put parentheses around what should be $1
print "ok!\n";
print $1;
} else {
print "not ok!\n";
}

Ty vm =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.