Thanks
The problem was when the regexp was executed.
When the textarea contains an "\n", the pattern constructed with this
value did not produce what I wanted when passed to exec ; I had to
escape regexp in the string (i.e. the section value) before
constructing the pattern.

FrD

On 28 juil, 23:54, PMario <[email protected]> wrote:
> 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
>...
> 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.

Reply via email to