Displaying 20 results from an estimated 40000 matches similar to: "gsub vs. replace"
2012 Dec 13
2
replace parenthetical phrases in a string
R-helpers,
I have a vector of character strings in which I would like to replace each
parenthetical phrase with a single space, " ". For example if I start with
x, I would like to end up with y.
x <- c("My toast=bog(keep=3 no=4) and eggs(er34)omit=32",
"dogs have ears",
"cats have tails (and ears, too!)")
y <- c("My toast=bog and eggs
2011 Aug 19
1
gsub for numeric characters in string
Dear all,
I have what is a bit of a confusing question, so I hope that I can explain
clearly. Thank you for your help in advance.
I would like to do a replacement procedure on several strings, but the way
that I am currently going about it is not working.
I have defined "len", which is a series comprising the lengths of different
items, all preceded by a colon.
> len
[1]
2006 May 19
10
Content Rotate, unwanted flashing on IE.
I just wrote a stupid little JS object to rotate DOM Elements (mainly
images) using Prototype and Script.aculo.us as support. Everything seems
to work well on IE and Firefox Linux but on FireFox Windows I am getting
a slight flash prior to transition.
I was wondering if a effects guru could take a quick look and see if
anything jumps out. I can live with the flash for my current project but
2006 Jun 12
10
Cross Broswer Fire Event
Is there a standard way of programmatically firing an event on an
element? I think this code works in IE but not FF:
myElement.fireEvent(''onclick'');
I really only care about IE and FF, but anything else is a bonus. I
didn''t see anything in prototype/scriptaculous for this, but I might
have missed it. Thanks.
Joe Athman
2005 Jan 11
7
default error page
Help, please.
I need redirection to a custom error page, instead of
the default Rails messages (e.g. Unknown action).
I use WebRick, no Apache, and i think i can''t use
public/.htaccess (# General Apache options).
Thanks.
___________________________________
Nuovo Yahoo! Messenger: E'' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica
Scaricalo ora!
2009 Sep 30
3
How to search and replace all urls on a HTML string using RUBY gsub
Hi ,
I trying to search and replace all urls on a HTML string
using gsub .
CODE
html = "<a href=''http://site.com.br''><img src=''http://site3.com/
image.jpg''></a><a href=''http://newx.com.br''><img src=''http://localhost/
imagem.jpg''></a>";
pattern = /<a
2010 Mar 03
0
Using gsub to replace text with link from database
I''m really close to solving this that I can smell it. In a nutshell I''m
trying to create this:
http://www.baseball-reference.com/friv/link_players.cgi
I have an app that has a database of baseball players.
I''m trying to create a feature where you can copy and paste your blog
text, the feature will scan the text and return the text with the
proper html links of my app
2006 May 24
7
Using inline editor without requiring a URL
Hi,
I was wondering if anyone has implemented the inplace editor without the
need for the URL. I have tried this but run into a problem in that the
''saving...'' text in shown for ever and the label is no longer editable.
Can I also confirm that my idea of the callback function is something that
runs before the value is passed to the URL (if you were to use one). What
might be
2009 Oct 05
1
gsub - replace multiple occurences with different strings
Hi,
I search a way to replace multiple occurrences of a string with
different strings
depending on the place where it occurs.
I tried the following;
x <- c("xx y e d xx e t f xx e f xx")
x <- gsub("xx", c("x1", "x2", "x3", "x4"), x)
what I want to get is;
x =
x1 y y e d x2 e t f x3 e f x4
but what I get is;
x =
x1 y y e
2006 May 15
1
2 clone methods?
I was reviewing the prototype library (current SVN version) to try to
understand the library better. I noticed there are two implementations
of the "clone" method on the Position object. There is one before the
implementation of the page method and one after.
They both appear to be similar actions (copy the positioning from one
element to another) although the second implementation
2012 Mar 07
1
gsub: replacing double backslashes with single backslash
Hello everybody,
this might be a trivial question, but I have been unable to find this using
Google. I am trying to replace double backslashes with single backslashes using
gsub. There seems to be some unexpected behaviour with regards to the
replacement string "\\". The following example uses the string C:\\ which should
be converted to C:\ .
> gsub("\\\\",
2011 Nov 23
1
gsub, utf-8 replacements and the C-locale
Hi all,
I'd like to discuss a infelicity/possible bug with gsub. Take the
following function:
f <- function(x) {
gsub("\u{A0}", " ", gsub(" ", "\u{A0}", x))
}
As you might expect, in utf-8 locales it is idempotent:
Sys.setlocale("LC_ALL", "UTF-8")
f("x y")
# [1] "x y"
But in the C locale it is not:
2017 Aug 27
0
regex - optional part isn't considered in replacement with gsub
Omar:
I don't think this can work. For example number-letter patterns 4),
5), and 6) would all be matched by pattern 6).
As Jeff indicated, you need to provide the delimiters -- what
characters come before and after the SKU patterns -- to be able to
recognize them. In a quick look at the text file you attached, the
delimiters appeared to be either "-" or " " (blank) and
2006 May 11
2
Field and Form.Element design question
Quick design question. I am trying to get a better understanding of
Prototype. While reading through the source I am stumped by form.js.
There is a "Field" object and a "Form.Element". Both object seem to
consists of a series of actions that making interacting with form fields
easier.
My question is why two objects? It seems that there should be one object
that has this
2017 Aug 27
6
regex - optional part isn't considered in replacement with gsub
Hello, I need some help with regex.
I have this to sentences. I need to extract both "49MU6300" and "LE32S5970"
and put them in a new colum "SKU".
A) SMART TV UHD 49'' CURVO 49MU6300
B) SMART TV HD 32'' LE32S5970
DataFrame for testing:
ecommerce <- data.frame(a = c(1,2), producto = c("SMART TV UHD 49'' CURVO
49MU6300",
2017 Aug 28
0
regex - optional part isn't considered in replacement with gsub
"Please, consider that some SKUs have "-"
in the middle, for example: "PG-9021".
Then you need to include these in the list of patterns you gave. Try it
again -- this time with a **complete** list.
-- 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
2010 Apr 28
1
gsub,regex and replacing
Dear group,
I need to modify some characters in a data frame. I want to use gsub and the
regex functionalities to do this.
Here is the data frame (df):
DESCRIPTION prix quantity
1 CORN Jul/10 -1.5 0
2 CORN May/10 -1082.0 -3
3 ROBUSTA COFFEE (10) Jul/10 11084.0 8
4 SOYBEANS Jul/10 1983.5
2012 Aug 22
4
gsub -> replace substring in column
Hi all,
please excuse- I'm a complete newbie to R, so it's possible my question was asked a thousand times before, but I don't get it :-(
I imported a CSV file via:
x=read.csv("test.csv",header=TRUE,sep="\t")
In a column there are values with the dot-character (".") I want to replace with a commata:
> x[9]
?????????????????? V16
1???????? GPS
2009 Mar 22
0
gsub('(.).(.)(.)', '\\3\\2\\1', 'gsub')
there seems to be something wrong with r's regexing. consider the
following example:
gregexpr('a*|b', 'ab')
# positions: 1 2
# lengths: 1 1
gsub('a*|b', '.', 'ab')
# ..
where the pattern matches any number of 'a's or one b, and replaces the
match with a dot, globally. the answer is correct (assuming a dfa
engine).
2009 Mar 22
0
gsub('(.).(.)(.)', '\\3\\2\\1', 'gsub') (PR#13617)
Full_Name: Wacek Kusnierczyk
Version: 2.10.0 r48181
OS: Ubuntu 8.04 Linux 32bit
Submission from: (NULL) (129.241.199.135)
there seems to be something wrong with r's regexing. consider the following
example:
gregexpr('a*|b', 'ab')
# positions: 1 2
# lengths: 1 1
gsub('a*|b', '.', 'ab')
# ..
where the pattern matches any number of