On Nov 13, 2007 4:33 AM,  <[EMAIL PROTECTED]> wrote:
> HI
>
> my conditions are
>
> //Code length rule (Min - 6 and Max-8)
> //leftmost character must be alpha character rule
> //first character of inward code must be numeric rule
> //second character of inward code must be alpha rule
> //third character of inward code must be alpha rule
> //space in position length-3 rule
> //only one space rule
>
> (i.e)  NOV 1GR
>
>
> my regex is
> ^[a-z]{2,4}\s(\d\w+){3})!gi;
>
> Can u correct my error.thanks...............
snip

I am not sure I understand your rules, but I think your problem is
(\d\w+){3}.  I think this is supposed to correspond to

//first character of inward code must be numeric rule
//second character of inward code must be alpha rule
//third character of inward code must be alpha rule

but what it is really saying is match a numeric character (not [0-9],
but any numeric character*) followed by one or more word characters
(not [a-zA-Z], it includes all non-punctuation and control characters)
three times, that is it will only match strings like "1a2bc3abcdefg".
I believe you want /\d[a-z]{2}/i.

* This is due to Perl using UTF8 by default now.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to