s-news
[Top] [All Lists]

regexpr problem

To: s-news@wubios.wustl.edu
Subject: regexpr problem
From: array chip <arrayprofile@yahoo.com>
Date: Thu, 28 Aug 2003 11:30:01 -0700 (PDT)
Hi,

I encountered a problem using "regexpr". The code
works fine in R, but not in S-Plus:

when run in R, it shows what I wanted (and it make
sense as well):
> regexpr("(JA)?[0-9]+","JA87")
[1] 1
attr(,"match.length")
[1] 4

but if I try it in S-Plus:
> regexpr("(JA)?[0-9]+","JA87")
[1] -1
attr(, "match.length"):
[1] -1

Basically, I wanted to match a pattern where there
might be letters "JA" preceding some numbers. Is there
something wrong with my code, or this a bug is S-Plus?

Thanks




__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

<Prev in Thread] Current Thread [Next in Thread>