meshgraphics wrote:
> Attn: Tourists
>
> This newsgroup is for people who have actually written a
DW extension, not
> feature requests for newbies.
Massimo has written quite a few extensions, and Randy is one
of the engineers that works on Dreamweaver, so it might be worth
backing off a bit with the attitude if you intend to get help from
folks.
> The RexExp features listed at regularexpression.com do
not matter when you are
> trying to troubleshoot your DW extension. What matters
is: what actually works
> in the DW extension environment.
They do to a certain extent, as they refer to the use of
regular expressions within JavaScript, which Dreamweaver does use
in extensions. Note this page:
http://www.regular-expressions.info/javascript.html
It states:
/m enables "multi-line mode". In this mode, the caret and
dollar match before and after newlines in the subject string.
It also states:
Notably absent is an option to make the dot match line break
characters.
Based upon both of these statement, the RegExp you present
below does not do what you want it to do in JavaScript, regardless
of Dreamweaver's involvement or not. The m flag does not allow the
. character to match new lines in JavaScript and so you won't get
from the beginning of the input string, rather you'll get from the
beginning of the line that MARKER happens to be on.
> The purpose of the original questions and code snippet
was to grab the top
> portion of a file, up to the marker, in its original
format, so that it could
> be written as is, to the output file. According to old
js, something like this
> would work:
>
> Slurp = /(^.*)MARKER(.*?)/m.exec(MultilineInputString);
> write(Slurp[1]); // <html><head><body>
> write(Slurp[2]); // </body></html>
What "old js" are you referring to that says that this should
work the way you are saying it should?
For this code:
<html>
<head>
<title>My Document</title>
</head>
<body>
MARKER
</body>
</html>
This RegExp grabs the content from the beginning of the code
before MARKER, and also the content after MARKER through the end of
the code:
/^((?:.|\r|\n)*)MARKER((?:.|\r|\n)*)$/
--
Danilo Celic
| Extending Knowledge Daily :
http://CommunityMX.com/
| Adobe Community Expert