How about this?
if (/PT\s*\(?(\w+)\)?/) {
$value = $1;
}
PT Matches the PT
\s* Matches any number (or no) spaces
\(? Matches one or none ('s
(\w+) Matches one or many word characters
\)? Matches one or none )'s
$1 Value caught by (\w+)
I think. .. .. maybe.
> At 05:13 PM 5/10/2001 -0400, Gross, Stephan wrote:
> >I want to match the following:
> >1) the letters "PT"
> >2) a space or nothing
> >3) a word that may or may not be in parentheses or even not exist
> >and return item #3 (which may be null)
> >Example:
> >PT (XYZ) or PT XYZ or PTXYZ or PT
> >should return "XYZ" except the last case, which should return "".
> >
> >I can do everything except the parentheses case. Any ideas?
> >
> >Thanks!
> >_______________________________________________________
> >Stephan Gross Loral Skynet 908-470-2388 [EMAIL PROTECTED]
> ><mailto:[EMAIL PROTECTED]>
> >
> >
>
>