Hi,
I think your regexp is wrong
test this. It is not a solution, but may be some pointers.
var text = store.getTiddlerText(tid.title+'##JSON',"{}");
var pattern = /(!{1,6}JSON[\s\S\n])([\s\S\n]*)(!{1,6}EndJSON)/im;
var te = pattern.exec(text);
if (te != null) {
result[0] = te[0];
oldval = te[1];
result[2] = te[2];
} else {
result[0] = "";
}
console.log('parts: ', result)
This is, what the regexp does. lines not starting with an x are broken
by the list
x"(" + // Match the regular expression below and capture
its match into backreference number 1
x "!" + // Match the character “!” literally
x "{1,6}" + // Between one and 6 times, as many times as
possible, giving back as needed (greedy)
x "JSON" + // Match the characters “JSON” literally
x "[\\s\\S\n]" + // Match a single character present in the
list below
x // A whitespace character (spaces, tabs, and
line breaks)
x // Any character that is NOT a whitespace
character
x // A line feed character
x")" +
x"(" + // Match the regular expression below and capture
its match into backreference number 2
x "[\\s\\S\n]" + // Match a single character present in the
list below
x // A whitespace character (spaces, tabs, and
line breaks)
x // Any character that is NOT a whitespace
character
x // A line feed character
x "*" + // Between zero and unlimited times, as many
times as possible, giving back as needed (greedy)
x")" +
x"(" + // Match the regular expression below and capture
its match into backreference number 3
x "!" + // Match the character “!” literally
x "{1,6}" + // Between one and 6 times, as many times as
possible, giving back as needed (greedy)
x "EndJSON" + // Match the characters “EndJSON” literally
x")"
hope this helps
have fun!
Mario
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywiki?hl=en.