Closed GoogleCodeExporter closed 9 years ago
Regular expressions in FoxReplace are regular JavaScript expressions, so only
what is supported by JavaScript can be implemented. There is also some use of
XRegExp, which allows some partial emulation of lookbehind, but according to
the author it is limited:
http://blog.stevenlevithan.com/archives/javascript-regex-lookbehind
As for problem #2, it should work correctly, as the regexp is passed directly
to the constructor of RegExp. Do you have some specific example that shows this
wrong behaviour?
Original comment by marc.r...@gmail.com
on 22 Apr 2013 at 7:41
----------------------
EXAMPLE FOR PROBLEM #2
----------------------
REPLACE
(?=4)(20)
WITH
twenty
So if I apply this to
420
Foxreplace will convert it to
4twenty
but it should not do anything (I think, since I do not really understand
LookAhead)
So FoxReplace acts as if I has used (?<=4), ie LookBehind, rather than (?=4),
ie LookAhead
And indeed, Foxreplace will not convert
520
to anything other than
520
Original comment by sqgl2...@gmail.com
on 23 Apr 2013 at 3:08
I have tried to reproduce your example on this very page and it doesn't replace
anything (tested on FoxReplace 0.14.0 and Firefox 21.0).
Original comment by marc.r...@gmail.com
on 24 Apr 2013 at 3:15
I was wrong about PROBLEM #2. Sorry, I cannot reproduce it either (no I wasn't
stoned).
PROBLEM #1 Remains. Mind you I don't know why I used a backslash in my example
so let me restate it thus:
PROBLEM #1
Lookbehind eg (?<=x) is not accepted as a regular expression, even though
Lookahead eg (?=x)is accepted
I thought it might be because it requires "extended" regex but on Skinner's
test page only the Lookahead requires turning on the "extended" option, so
Lookbehind should work regardless (it appears the JavaScript being employed by
FoxReplace is using the "extended" option anyhow, since Lookahead works).
Original comment by sqgl2...@gmail.com
on 16 Jul 2013 at 2:44
Ok, now I have researched some more on the problem.
That test page, RegExr, is implemented in Flex, according to the author, and so
it's programmed in ActionScript. Although both ActionScript and JavaScript are
implementations of the same ECMA-262 standard, they have some differences. One
of the differences is that ActionScript (and thus RegExr) supports lookbehind
but JavaScript (and thus Firefox and thus FoxReplace) doesn't; the ECMA-262
standard doesn't support lookbehind either (source:
http://www.regular-expressions.info/refflavors.html), so it's an added feature
of ActionScript because of the regex engine it uses (source:
http://stackoverflow.com/a/6441148/792577).
So, the only way to support lookbehind is to wait until some day Firefox
supports it, if ever (then they would be supported in FoxReplace
automatically). Or maybe trying to integrate a third party regex engine, with
all the potential issues (compatibility, portability, licenses, new bugs, etc.)
this could create.
I don't want to mess with alternative regex implementations, so I will close
the issue because there isn't a good solution, sorry.
Original comment by marc.r...@gmail.com
on 16 Jul 2013 at 4:08
Original issue reported on code.google.com by
sqgl2...@gmail.com
on 21 Apr 2013 at 6:24