$Bill Luebkert wrote:
> Luke Bakken wrote:
>
> > What is the purpose of this illustration in the context of the
>
>>original stated problem? The original problem stated that the string
>>will have different numbers of alphabetic characters and numbers while
>>your regex specifies 4 digits exactly. My code was in reference to the
>>"potential problem with this algorithm" statement above where that
>>person thought that old values for $1 and $2 may carry forward through
>>match operations, which they do not, as illustrated below.
>
>
> Easily remedied (I noted on it if they were exactly 4) this will handle
> otherwise :
>
> if (/^(\D{1,4})(\d{1,4})$/) {
Or even less restictive (1-7) :
if (/^(\D{1,7})(\d{1,7})$/) {
But both lose the test for 8 characters total which you may want to add back on.
> print "alpha='$1' num='$2'\n";
> } else {
> print "Bad expr: $_\n";
> }
>
> The point is that it's just one if that does it all.
>
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs