similar to: Calling a method in a gsub?

Displaying 20 results from an estimated 30000 matches similar to: "Calling a method in a gsub?"

2009 Oct 03
1
Named backreference in gsub()?
Hi, I'm running out of the *numbered* backreferences \\1, \\2, ..., \\9 for gsub(). Does R support *named* backreferences, and if so, what is the syntax? Thanks Henrik
2004 Oct 27
1
regexp,grep: capturing more than one substring
Hello, I would like to have a function that retrieve matching strings in the same way as with java.util.regex (java 1.4.2). Example: f('^.*(xx?)\\.([0-9]*)$','abcxx.785') => c('xx','785') First of all: Is it possible to achiev this with grep(... perl=TRUE,value=TRUE )? As I would call this function very often with large data, I'm reluctant to use Sjava
2006 Feb 19
4
Multiple Characters Negate Using Regexp
Dear experts, I am trying to build a regular expression to filter out anything between <script ... > and </script> tags where I can specify something using negate class to exclude more than one character in sequence. I tried: originalresponse.gsub(/<script([^>]+)>([^<]+)?<\/script>/,'''') but obviously if the script has the
2006 Jan 27
4
regular expressions, sub
Hi, I am trying to use sub, regexpr on expressions like log(D) ~ log(N)+I(log(N)^2)+log(t) being a model specification. The aim is to produce: "ln D ~ ln N + ln^2 N + ln t" The variable names N, t may change, the number of terms too. I succeded only partially, help on regular expressions is hard to understand for me, examples on my case are rare. The help page on R-help
2018 Feb 17
2
readLines interaction with gsub different in R-dev
| Confirmed for R-devel (current) on Ubuntu 17.10. But ... isn't the regexp | you use wrong, ie isn't R-devel giving the correct answer? No, I don't think R-devel is correct (or at least consistent with the documentation). My interpretation of gsub("(\\w)", "\\U\\1", entry, perl = TRUE) is "Take every word character and replace it with itself, converted to
2007 Dec 04
2
Bug: NoMethodError: private method `gsub'' called for nil:NilClass
Hi there. I''m using RedCloth as part of a social network''s blog system. I came across the following bug when an img tag with the src attribute is inputted, and filter_html is set to true. I have pasted the code sample below. >> require ''RubyGems'' => true >> require ''RedCloth'' => true >>
2009 Nov 16
2
on gsub (simple, but not to me!) sintax
Dear R users, my problem today deals with my ignorance on regular expressions. a matter I recently discovered. Consider the following foo <- c("V_7_101110_V", "V_7_101110_V", "V_9_101110_V", "V_9_101110_V", "V_9_s101110_V", "V_9_101110_V", "V_9_101110_V", "V_11_101110_V", "V_11_101110_V",
2001 Aug 02
1
gsub() and parenthesis symbols
Dear R-users -- I'm using R 1.3.0 on a PC running SuSE Linux 7.1. I'm confused by the following behavior from the gsub() function. Am I doing something wrong? ## A string of characters > string<-c("q","w","e","(",")","q","w","e") ## Use gsub to replace `q' with `A' >
2007 Jan 27
1
gsub regexp question
Dear R Users, I am trying to users gsub to remove multiple cases of square brackets and their different contents in a character string. A sample of such a string is shown below. However, I am having great difficulty understanding regexp syntax. Any help is greatly appreciated. Ally "tree STATE_286000 [&lnP=-12708.453945423369] = [&R]
2006 Jan 17
14
Going nuts on ''\n'' to <br />
Hi all, Is there no way to easily resolve this. It can''t be that I''m the first that wants this, and it wouldn''t be RoR if it''s not possible. On the mysql prompt with the select description from todos .. linefeeds are show, so they are there. This is the actual contents with a linefeed after the ":" "Project contacts: delete table, point
2006 Dec 07
4
Removing a block of text within a string
When you first visit my site, you see a snippet (the first 75 words) of the most recent post. If it exceeds 75 words, a link will be appended to extend the post and read it in full. Now, my problem is when I post a code snippet, and I use "pre" tags to preserve its formatting, I don''t want that to show up on the snippet... only on the full version of the post. The reason is
2018 Feb 13
1
Help with regular expressions
You can either use positive lookahead/lookbehind - but support for that is a bit flaky. Or write a proper regex, and use backreferences to keep what you need. R > x <- "abc 1,1 ,1 1, x,y 2,3 " R > gsub("(\\d),(\\d)", "\\1.\\2", x, perl = TRUE) [1] "abc 1.1 ,1 1, x,y 2.3 " B. > On Feb 12, 2018, at 9:34 PM, Jim Lemon <drjimlemon at
2018 Feb 17
2
readLines interaction with gsub different in R-dev
I was told to re-raise this issue with R-dev: In the documentation of R-dev and R-3.4.3, under ?gsub > replacement > ... For perl = TRUE only, it can also contain "\U" or "\L" to convert the rest of the replacement to upper or lower case and "\E" to end case conversion. However, the following code runs differently: tempf <- tempfile()
2011 Oct 05
3
help with regexp
Dear list memebers, I am stuck with using regular expressions. Imagine I have a vector of character strings like: test <- c('filename_1_def.pdf', 'filename_2_abc.pdf') How could I use regexpressions to extract only the 'def'/'abc' parts of these strings? Some try from my side yielded no results: testresults <-
2004 Oct 28
1
gsub() on Matrix
Hi, Suppose I've got a matrix, and the first few elements look like "x1 + x3 + x4 + x5 + x1:x3 + x1:x4" "x1 + x2 + x3 + x5 + x1:x2 + x1:x5" "x1 + x3 + x4 + x5 + x1:x3 + x1:x5" and so on (have got terms from x1 ~ x14). If I want to replace all the x1 with i7, all x2 with i14, all x3 with i13, for example. Is there an easy way? I tried to put what I want
2007 Jul 26
3
substituting dots in the names of the columns (sub, gsub, regexpr)
Dear R users, I have the following two problems, related to the function sub, grep, regexpr and similia. The header of the file(s) I have to import is like this. c("y (m)", "BD (g/cm3)", "PR (Mpa)", "Ks (m/s)", "SP g./g.", "P (m3/m3)", "theta1 (g/g)", "theta2 (g/g)", "AWC (g/g)") To get rid of spaces and
2009 Mar 12
2
R grep & gsub issue - sign seems to be causing an issue...
I would like to use grep and gsub to manipulate a vector to make the names used consistent, i.e. reduce a level or two. However, here is what I found when I attempted to use grep and gsub: > tmp_test<-c("House 1 Plot Plus +100","House 2 Plot Plus +100","House 3 Plot Plus -100","House 4 Plot Plus -100","House 1 Plus +100","House 2
2017 Aug 23
1
Flummoxed by gsub().
On 24/08/17 02:46, Bert Gunter wrote: > Inline. > > -- Bert > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Wed, Aug 23, 2017 at 2:29 AM, Rolf Turner <r.turner at
2017 Aug 23
0
Flummoxed by gsub().
Inline. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Aug 23, 2017 at 2:29 AM, Rolf Turner <r.turner at auckland.ac.nz> wrote: > > On 23/08/17 18:33, Stefan Evert wrote: > >> >>> On 23 Aug 2017,
2006 Apr 24
3
gsub + backslashes
Dear developeRs, I thought that backslashes can be escaped in the usual way (and I think I did this before) but I can't see why R> gsub("\\", "x", "\alpha") Error in gsub(pattern, replacement, x, ignore.case, extended, fixed, useBytes) : invalid regular expression '\' gives an error. Or am I just blind? Best, Torsten R> version