Why don't you check the length of the string as well .. ie
if (length($word) == 5 && $word =~ /^(un|in|non).+$/) {
## Do something
}
________________________________
From: Somu <[email protected]>
To: [email protected]
Sent: Sunday, April 8, 2012 4:30 PM
Subject: regex
Hello everyone...
Thanks for the previous replies. I'm really improving!
A new problem..
Check if the word begins with un or in and has exactly 5 letters.
$word =~ '^(un|in).{3}$'
Check if the word begins with un or in or non and has more than 5 letters.
$word =~ '^(un|in).{3}.+$'
What do i do about the words starting with "non" because it has one more
letter than un or in
--
Love,
Somu,