s-news
[Top] [All Lists]

Re: Quick SPlus Question on Regular Expressions..

To: Santosh <santosh2005@gmail.com>
Subject: Re: Quick SPlus Question on Regular Expressions..
From: Chuck Cleland <ccleland@optonline.net>
Date: Sun, 01 Jul 2007 05:31:17 -0400
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <816b5ce40706302244j6dad4e5dqb9333739d89aa6f@mail.gmail.com>
References: <816b5ce40706302244j6dad4e5dqb9333739d89aa6f@mail.gmail.com>
User-agent: Thunderbird 1.5.0.12 (Windows/20070509)
Santosh wrote:
> Quick question for the SPLUSians
> 
> Is there a way to substitute a pattern in a text string with another,
> like done using Perl?
> 
> regexpr would find the expression.but could not figure out the way to
> replace a pattern with another!
> 
> Thanks in advance for all your help!
> 
> Regards,
> Santosh

  I have Professional Edition Version 6.2.1, which has
substituteString().  For example:

> mystrings <- c("data1.TXT", "data2.tXt", "data3.txt")

> substituteString("[Tt][Xx][Tt]$", "dat", mystrings)
[1] "data1.dat" "data2.dat" "data3.dat"

?substituteString

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

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