At 10:38 AM 3/24/2006 -0700, Paul Rousseau wrote:
>   I am looking for help on a regex that examines strings such as
>
>"xxxN yyyyyyy sssNNN"
>"xxxN yyyNyyy sssNNNN"
>"xxxN yyyNyyy ssssssN"
>
>and returns only the sss part?  N is always a numeral, and s is always 
>alphabetic.

Do u have to examine those as fixed strings or as variable strings?  Meaning
do u know ahead of time which format ur looking at.  If u don't know the
format ahead of time then u should use the regex.  But if u do know the
format ahead of time (like it never changes for one application) then u
shouldn't use a regex.  Using substr will be faster.

"xxxN yyyyyyy sssNNN"
$s = substr $string, 13, 3;
"xxxN yyyNyyy sssNNNN"
$s = substr $string, 13, 3;
"xxxN yyyNyyy ssssssN"
$s = substr $string, 13, 6;

#don't know what format $string will be
$s = $string =~ m/\S+ \S+ ([a-z])+/i;






--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to