Re: Regex Needed

2006-03-25 Thread DZ-Jay
Unpack is even faster, for fixed-format strings. dZ. On Mar 24, 2006, at 22:19, Chris Wagner wrote: 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 yyy sssNNN" "xxxN yyyNyyy sss" "xxxN yyyNyyy ssN"

Re: Regex Needed

2006-03-24 Thread Chris Wagner
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 yyy sssNNN" >"xxxN yyyNyyy sss" >"xxxN yyyNyyy ssN" > >and returns only the sss part? N is always a numeral, and s is always >alphabetic. Do u have to examine

Re: Regex Needed

2006-03-24 Thread
Try this: $string =~ /^.{3}\d\s[^\s]+\s([a-zA-Z]+)\d+$/; $prefix = $1; That should match: - any three characters at the beginning of the string: ^.{3} - followed by a number: \d - followed by whitespace: \s - followed by any one or more characters until the next whitespace [^\s]+ -

Re: Regex Needed

2006-03-24 Thread David Legault
Something like this : /(\w\s){2}([a-zA-Z]+)\d*/ David Joe Discenza wrote: Paul Rousseau wrote, on Friday, March 24, 2006 12:38 PM :I am looking for help on a regex that examines strings such as : : "xxxN yyy sssNNN" : "xxxN yyyNyyy sss" : "xxxN yyyNyyy ssN" : : and returns

Re: Regex Needed

2006-03-24 Thread Brian H. Oak
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 _ Bria

RE: Regex Needed

2006-03-24 Thread Jerry Kassebaum
$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

RE: Regex Needed

2006-03-24 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: > Hello, > >I am looking for help on a regex that examines strings such as > > "xxxN yyy sssNNN" > "xxxN yyyNyyy sss" > "xxxN yyyNyyy ssN" > > and returns only the sss part? N is always a numeral, and s is always > alphabetic. > > Here is what I have so

RE: Regex Needed

2006-03-24 Thread Joe Discenza
Paul Rousseau wrote, on Friday, March 24, 2006 12:38 PM :I am looking for help on a regex that examines strings such as : : "xxxN yyy sssNNN" : "xxxN yyyNyyy sss" : "xxxN yyyNyyy ssN" : : and returns only the sss part? N is always a numeral, and s : is always alphabetic. Does