Closed GoogleCodeExporter closed 9 years ago
It's strange, because I have tried it a lot of times and has always worked. But
I will try it with your example and tell you if I can reproduce the problem.
Original comment by marc.r...@gmail.com
on 25 Sep 2010 at 2:51
any luck? here's my exported settings with the bug
Original comment by OwynTyler
on 11 Oct 2010 at 10:51
Attachments:
Hi, now I have discovered what the problem is.
Short answer: use $1 instead of \1.
Long answer: \1 references memory #1 in the RegExp (the input); for example,
"/video/(\d+)/[^"]+/\1" would match "/video/12345/hello/12345". But to
reference memory #1 in the output you have to use $1 instead.
Original comment by marc.r...@gmail.com
on 13 Oct 2010 at 11:03
>>Status: Invalid
i use "\1" in notepad+ regex search and it works, i look at wikipedia and find
"\1" not anything like "$1".
$1 worked in foxreplace, but why did you make $1 in it but not \1 like the
standart says?
http://www.regular-expressions.info/brackets.html
http://www.explainth.at/en/re/backref.shtml
Original comment by OwynTyler
on 13 Oct 2010 at 12:15
\1 is the standard for *matching* a backreference, but not for using it in a
replace operation. From your first link (in "How to Use Backreferences"):
"The replacement text will use a special syntax to allow text matched by
capturing groups to be reinserted. This syntax differs greatly between various
tools and languages, far more than the regex syntax does."
I have just used the JavaScript syntax because it is what I can use.
Specifically, the substitutions are done with String.replace(), and these are
the special characters in the output:
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/repl
ace#Specifying_a_string_as_a_parameter
Original comment by marc.r...@gmail.com
on 13 Oct 2010 at 3:07
weird but like i said it works in replace field in notepad+ regex search &
Replace and in manuals that i gave you there were nothing about dollar param
"$1"
Original comment by OwynTyler
on 13 Oct 2010 at 5:59
In fact, if you follow one of the links in your first link, the one that says
"replacement text reference" (
http://www.regular-expressions.info/refreplace.html ), you will see a big table
with the RegExp syntax for several languages/platforms. There you can see that
the backreference using $n is used in .NET, Java, Perl, ECMA (this includes
JavaScript), and others.
Original comment by marc.r...@gmail.com
on 13 Oct 2010 at 8:46
oh now i see it's language program written in very dependant, thx.
Original comment by OwynTyler
on 14 Oct 2010 at 8:08
Original issue reported on code.google.com by
OwynTyler
on 25 Sep 2010 at 11:31