in reply to Regex Question
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/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex Question
by shealyw2 (Initiate) on Nov 26, 2012 at 06:15 UTC | |
by Kenosis (Priest) on Nov 26, 2012 at 06:50 UTC |