similar to: Regex magic anyone?

Displaying 20 results from an estimated 2000 matches similar to: "Regex magic anyone?"

2008 Oct 28
1
gsubfn, strapply, REGEX Problem
Hi all, I swear this used to work: library(gsubfn) strapply("S(AC,P)TVDK(8)EELVQK(8), ".[(].{1,2}[)]|.")[[1]] But somewhere along the update path it stopped ... now giving me this Error in base::gsub(pattern, rs, x, ...) : invalid backreference 2 in regular expression Can't figure it out. What am I doing wrong? Thanks for any hints, Joh
2010 May 20
3
regex help: splitting strings with no separator
Greetings, I have a vector of values that are a word followed by a number, e.g., x = c("Apple12","HP42","Dell91"). The goal is to split this vector into two vectors such that the first vector contains just the words and the second contains just the numbers. I cannot use strsplit (or at least I do not know how) as there is no obvious separator. I can use sub to
2023 Apr 12
1
Split String in regex while Keeping Delimiter
On Wed, 12 Apr 2023 08:29:50 +0000 Emily Bakker <emilybakker at outlook.com> wrote: > Some example data: > ?leucocyten + gramnegatieve staven +++ grampositieve staven ++? > ?leucocyten ? grampositieve coccen +? > ? > I want to split the strings such that I get the following result: > c(?leucocyten +?, ??gramnegatieve staven +++?, > ??grampositieve staven ++?) >
2008 Nov 11
2
strsplit (regex)
#how do I break these up into first two letters (RM), number, and then the last part #is there an easily accessible regex tutorial on the internet? v = (structure(1:122, .Label = c("RM215Temp", "RM215SpCond", "RM215DO.Conc", "RM215Depth", "RM215pH", "RM215ORP", "RM215Turbidity.", "RM215Battery", "RM215DO.",
2010 Nov 17
1
[LLVMdev] L->isLoopInvariant giving wrong results?
my changed code. namespace { class MyLoopPass:public LoopPass { bool changed; public: static char ID; Loop* curLoop; // AnalysisType* AA; DominatorTree* DT; LoopInfo* LI; MyLoopPass() : LoopPass(ID){} bool isLoopInvariantInst(Instruction &I) ; bool runOnLoop(Loop * L, LPPassManager &lpm); virtual void getAnalysisUsage(AnalysisUsage &AU) const {
2010 Jul 19
1
Help with replacing a substring in a string
Dear R Users, I am trying to replace a substring in a string with something else. For example: if we have "abc.degg.hijk" I would like to replace all the "." with a SPACE to become "abc degg hijk" I have tried the replace.substring.wild function in the Hmisc package but get this error: > replace.substring.wild("abc.degg.hijk","*.*","
2011 Oct 24
2
splitting a string into words preserving blanks (using regex)
I would like to split a string into words at its blanks but also to preserve all blanks. Example: c(" some words to split ") should become c(" ", "some", " ", " words", " ", "to" , " ", "split", " ") I was not able to achieve this via strsplit() . But I am not familiar with regular
2010 Mar 15
2
tcltk and R
I have had some comments on sqldf regarding its dependence on tcltk such as the second last sentence on this blog post: http://translate.google.com/translate?hl=en&sl=zh-CN&u=http://www.wentrue.net/blog/%3Fp%3D453&prev=http://blogsearch.google.com/blogsearch%3Fhl%3Den%26ie%3DUTF-8%26q%3Dsqldf%26lr%3D%26sa%3DN%26start%3D10 sqldf does not directly use tcltk but it does use strapply in
2010 Nov 17
2
[LLVMdev] L->isLoopInvariant giving wrong results?
Hi, I'm trying to write a simple pass to print out Loop invariant instructions, using the Loop::isLoopInvariant(Instruction *I) function. it is giving me false value on instructions which should be loop invariant. the code i am using is: bool MyLoopPass::runOnLoop(Loop * L, LPPassManager &lpm){ BasicBlock* lat=L->getLoopLatch(); for (BasicBlock::iterator i = lat->begin(), e =
2009 Aug 04
4
regex question
Hi, I am getting stuck over an apparently simple problem in the use of regular expressions : To collect together the first letters of the words from the Perl motto, ?There is more than one way to do it? in the following form ? TIMTOWTDI. I tried the following code : ? ##### A regex problem with the Perl motto astr<-"There is more than one way to do it" b1<-grep("\\<",
2010 Jul 02
3
Good Package(s) for String and URL processing?
Are there packages that allow improved String and URL processing? E.g. extract parts of a URLs such as sub-domains, top-level domain, protocols (e.g. https, http, ftp), file type based on endings, check if a URL is valid or not, etc... I am currently only using split and paste. Are there better and more efficient ways to handle strings e.g. finding sub-strings or to do pattern matching? What
2010 Aug 26
5
Quick GREP challenge
> grep("f[0-9]+=", "f1=5,f22=3,", value = T) [1] "f1=5,f22=3," How do I make the line output c("f1", "f22") instead? (Actually, c(1,22) would be even better). Thank you. -- View this message in context: http://r.789695.n4.nabble.com/Quick-GREP-challenge-tp2339486p2339486.html Sent from the R help mailing list archive at Nabble.com.
2008 Jan 23
1
Package Building and Name Space
Hello, I just don't get this and would appreciate if someone could write a line or two: I'm trying to build this package and it stops installing after I add the following to the NAMESPACES file: >importFrom(gsubfn,strapply) The error during the package test is: Error in MyPackage::MyFunction : package 'MyPackage' has no name space and is not on the search path Calls:
2010 Nov 17
0
[LLVMdev] L->isLoopInvariant giving wrong results?
On Nov 17, 2010, at 2:20 AM, Sreeraj a wrote: > Hi, > I'm trying to write a simple pass to print out Loop invariant instructions, using the > Loop::isLoopInvariant(Instruction *I) > function. it is giving me false value on instructions which should be loop invariant. > > the code i am using is: The isLoopInvariant method just works for scalar operations like
2008 Nov 02
5
R newbie: how to replace string/regular expression
Hello; I am a R newbie and would like to know correct and efficient method for doing string replacement. I have a large data set, where I want to replace character "M", "b", and "K" (currency in Million, Billion and K) to millions. That is 209.7B with (209.7 * 10e6) and 100.00K with (100.00 *1/100) and etc.. d <- c("120.0M", "11.01m",
2008 Aug 12
2
perl expression question
I have a string such as fileName<-"Agg.20.20.20-all-01". All I want to do is pull the "20.20.20" and the "all" as strings. Obviously, they aren't always those values. The "20.20.20" can be "30.30.30" but it's always after the . which is next to the second g in Agg and it's always the same length. The all might not always be
2008 Aug 06
2
matching problem
I have a matching problem that I cant solve. mystring = "xxx{XX}yy{YYY}zzz{Z}" where "x","X","y","Y","z","Z" basiclly can be anything, letters, digits etc. I'm only interested in the content within each "{}". I am close but not really there yet. library(gsubfn) strapply(mystring,"\\{[^\\}]+",, perl=F)
2010 Jun 03
5
string handling
I have a data.frame as the following: var1 var2 9G/G09 abd89C/T90 10A/T9 32C/C 90G/G A/A . . . . . . 10T/C 00G/G90 What I want is to get the letters which are on the left and right of '/'. for example, for "9G/G09", I only want "G", "G", and for "abd89C/T90", I only want "C" and
2008 Aug 01
2
Extract Element of String with R's Regex
Hi, I have this string, in which I want to extract some of it's element: > x <- "Best-K Gene 11340 211952_at RANBP5 Noc= 3 - 2 LL= -963.669 -965.35" yielding this array [1] "211952_at" "RANBP5" "2" In Perl we would do it this way: __BEGIN__ my @needed =(); my $str = "Best-K Gene 11340 211952_at RANBP5 Noc= 3 - 2 LL= -963.669
2010 May 05
1
extracting a matched string using regexpr
Given a text like I want to be able to extract a matched regular expression from a piece of text. this apparently works, but is pretty ugly # some html test<-"</tr><tr><th>88958</th><th>Abcdsef</th><th>67.8S</th><th>68.9\nW</th><th>26m</th>" # a pattern to extract 5 digits > pattern<-"[0-9]{5}" #