$string = "MBH1 WELL PIT050";
$string =~ s/.* (.*?)\d+/\1/; # Questionmark makes it non-greedy ($prefix) = $string; # Didn't figure out how to do ($prefix) = $string =~
print "$prefix";
<>;



**************

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