You could use substr for this:
use strict; use warnings; my $string = 'That string is funny!'; if ( substr( $string, 2, 1 ) eq 'a' ) { print 'The third character in $string is an "a".'; }
But if you're set on a regex, the following will match a string whose third character is "a":
$string =~ /^..a/
In reply to Re: Regex Question
by Kenosis
in thread Regex Question
by shealyw2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |