Hi Eric,
Jeremy suggested that I post it here
I found in
TiddlyWiki5 / editions / tw2 / source / tiddlywiki.com / tiddler2tid
in line 33 this regexp
\s*(\w+)\s*=\s*["']([^"']*)["']\s*
to identify attributes and their values.
You have to know, I'm a bit picky when it comes to regular expressions and
also perl (as I just noticed that it#s perl) ;) so I thought this would be
better written in two lines because if you use " to quote, you're free to
use ' insed and vice versa.
So one should use something like this:
\s*(\w+)\s*=\s*"([^"]*)"\s* and if it didn't match
\s*(\w+)\s*=\s*'([^']*)'\s*
But I think, as it is perl and so *backreferences *and *non-greedy *matches
work, this would be a better alternative:
\s*(\w+)\s*=\s*(["'])(.*?)\2\s*
So the whole line would be:
$attrs =~ s/\s*(\w+)\s*=\s*(["'])(.*?)\2\s*/$1: $3\n/gs;
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/groups/opt_out.