Paul,

Give this a shot:

/^\w+\s+\w+\s+([A-Za-z]+)\d+/

A regex should be as explicit and exclusive as possible, so I would remove the lowercase (a-z) portion of the character class if you know for sure that the letters you want will always be uppercase.

-Brian

_________________________
Brian H. Oak   CISSP CISA
Acorn Networks & Security
<http://acornnetsec.com/>


Hello,

  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.

Here is what I have so far as an example. I believe there is an eloquent way to do this in a single regex.

my (
     $string,
     $prefix
    );

$string = "MBH1 WELL PIT050";
($prefix) = $string =~ ????????????           # I want $prefix to equal PIT

Thank you.


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

Reply via email to