in reply to Help with form validation regex
How about:
which prints:#!/usr/bin/perl while(<DATA>) { chomp; if( /\A[\w]{3}_\w+_ear\Z/ ) { print "$_ matches \n"; } else { print "no joy for $_ \n"; } } __DATA__ ab_wehave_noear abc_test_ear abc_test_two_ear abcc_test_ear
I realize your problem definition said "characters" not "word thingies". I'm confident you can munge it to match your expected input range.no joy for ab_wehave_noear abc_test_ear matches abc_test_two_ear matches no joy for abcc_test_ear
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help with form validation regex
by JavaFan (Canon) on May 11, 2009 at 19:11 UTC | |
by mikeraz (Friar) on May 11, 2009 at 21:51 UTC |