Displaying 20 results from an estimated 52 matches for "backreference".
Did you mean:
backreferences
2012 Apr 26
2
Using backreferences from node name regex match
I appears that backreferences when using regexes in node names doesn''t
work. Can anyone confirm this? If I''m incorrect, how do I go about using a
backreference to the name regex within the node definition container?
Thanks,
Guy
--
You received this message because you are subscribed to the Google Groups...
2007 Mar 08
2
Named backreferences in replacement patterns
Hi
I have a problem with substitutions involving named backreferences. I
have a vector American.dates:
> American.dates
[1] "5/15/1976" "2.15.1970" "1.9.2006"
which I want to change into British.dates:
> British.dates
[1] "15/5/1976" "15/2/1970" "9/1/2006"
I know I can do it like this:
British.da...
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
2012 Nov 02
2
backreferences in gregexpr
Hi Folks,
I'm trying to extract just the backreferences from a regex.
> temp = "abcd1234abcd1234"
> regmatches(temp, gregexpr("(?:abcd)(1234)", temp))
[[1]]
[1] "abcd1234" "abcd1234"
What I would like is:
[1] "1234" "1234"
Note: I know I can just match 1234 here, but the actual exampl...
2012 Nov 16
4
[LLVMdev] Proposal: Enhance FileCheck's variable matching capabilities
...I already have it in my branches and can provide a
full implementation with tests (FileCheck now has a test/ dir all of
its own since r168113) if the proposal is accepted.
The rough outline of the implementation:
To enable such matching in a natural way, our regex implementation
needs to support backreferences in matches. This then allows to find
all references to a variable defined on the same line and substitute
them by backrefs.
Luckily, our regex implementation already supports backreferences,
although a bit of hacking is required to enable it. It supports both
Basic Regular Expressions (BREs) and...
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)
2006 Oct 20
2
Calling a method in a gsub?
...e to do something like this:
string.gsub(regexp, output(''\0'' ,''\1'', ''\2'')
Output returns a string.
I tested it in irb and it worked ok. Now when it''s in my application,
the ''\1'' and others don''t resolve as backreferences to the matches as
they should. How can I fix this? Or go around it?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this g...
2007 Aug 23
2
Splitting strings
I'm having a Thursday morning mental block, any suggestions on the following
would be most appreciated...
I have (as an example)
surgery = c("d48", "d67", "dnc37", "a75", "d10", "a78", "d31",
"d55", "d1")
before each number part the possibilities are c("a", "d",
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 gmail.com> wrote:
>
> Hi Denni...
2005 Aug 20
2
Questions on "\" vs "/" on Windows
...'s fault). A pathalogical example
that I _have_ encountered due to temp file naming on Windows:
> badpath <- "foo\\2\\bar"
> root <- "c:\\HERE\\file.txt"
> gsub("HERE", badpath, root)
Error in gsub("HERE", badpath, root) : invalid backreference 2 in regular expression
Using file.path is recommended as a best practice, but AFAICT, it
forces "\" on Windows.
Why not have file.path dynamically read .Platform$file.sep
so that in code that uses file.path one could modify
.Platform$file.sep and change the behavior of all subsequent...
2006 Mar 28
0
New package gsubfn
gsubfn is a package with one function, gsubfn, that
is like gsub except instead of taking a replacement
string it takes a replacement function. For each
match, that match is passed to the replacement
function along with the backreferences, if any,
and replaced with the output of the function.
If the first two arguments are omitted the defaults
are set to do perl-style (sort of) string interpolation
as in last example.
gsubfn is available for all platforms via CRAN.
# makes all letters except first in word lower case
# output: &qu...
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
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
2006 Mar 28
0
New package gsubfn
gsubfn is a package with one function, gsubfn, that
is like gsub except instead of taking a replacement
string it takes a replacement function. For each
match, that match is passed to the replacement
function along with the backreferences, if any,
and replaced with the output of the function.
If the first two arguments are omitted the defaults
are set to do perl-style (sort of) string interpolation
as in last example.
gsubfn is available for all platforms via CRAN.
# makes all letters except first in word lower case
# output: &qu...
2007 May 02
1
1.0.2b7 misrenders nested divs with attributes
...lass="inlinepage">
<div class="toggleableend">
foo
</div>
</div>
It renders it as follows:
<div class="inlinepage">
<div class="toggleableend">
foo
</div>
<p></div></p>
The problem is that it uses a backreference in the expression that it
passes to gen_extract_tagged, which is broken when Text::Balanced
wraps it in parentheses. The attached patch fixes it.
--
Matt
-------------- next part --------------
--- Markdown.pl.orig 2006-08-29 19:11:53.000000000 -0700
+++ Markdown.pl 2007-05-02 00:28:53.000000000...
2007 May 09
3
Markdown.pl 1.0.2b8
Download:
<http://daringfireball.net/projects/downloads/Markdown_1.0.2b8.tbz>
Changes from 1.0.2b7:
+ Fixed bug with nested raw HTML tags that contained
attributes. The problem is that it uses a backreference in
the expression that it passes to gen_extract_tagged, which
is broken when Text::Balanced wraps it in parentheses.
Thanks to Matt Kraai for the patch.
+ Now supports URLs containing literal parentheses, such as:
http://en.wikipedia.org/wiki/WIM...
2004 Nov 19
3
how to get to interesting part of pattern match
Hi,
I am looking for a way to extract an "interesting" part of the match to
a regular expression. For example the pattern "[./](*.)" matches a
substring that begins with either "." or "/" followed by anything. I am
interested in this "anything" w/o the "." or "/" prefix. If say I match
the pattern against "abc/foo" I
2005 Mar 02
1
Error on Windows installing package to non-default library
...brary"
pkg = "c:\\falcon\\abind_1.1-0.zip"
install.packages(pkg, repos=NULL, lib=badLib)
package 'abind' successfully unpacked and MD5 sums checked
updating HTML package descriptions
Error in gsub("^URL: ../../../library", lib0, readLines(cfile)) :
invalid backreference 2 in regular expression
After looking at src/library/utils/R/windows/linkhtml.R, it seems the
error is that the "\\2" part of the path is interpreted by gsub as a
back reference.
Changing "\\" to "/" in the library path fixes this issue:
> okLib = chartr("...
2005 Aug 03
2
regexpr and portability issue
Dear all--
I am still forging my first arms with R and I am fighting with regexpr() as
well as portability between unix and windoz. I need to extract barcodes from
filenames (which are located between a double and single underscore) as well
as the directory where the filename is residing. Here is the solution I came
to:
aFileName <-
2012 Nov 17
0
[LLVMdev] Proposal: Enhance FileCheck's variable matching capabilities
...and can provide a
> full implementation with tests (FileCheck now has a test/ dir all of
> its own since r168113) if the proposal is accepted.
>
> The rough outline of the implementation:
>
> To enable such matching in a natural way, our regex implementation
> needs to support backreferences in matches. This then allows to find
> all references to a variable defined on the same line and substitute
> them by backrefs.
>
> Luckily, our regex implementation already supports backreferences,
> although a bit of hacking is required to enable it. It supports both
> Basic Re...