Hi all, if anyone needs a RegEx to take a string full of tags and
break it into an array of valid tags, using:
var tagList = tagString.match(/(\[{2}(\w+(\.?|\S?)(\s?)(\w*))+\]
{2})|(\[(\w+((\S)\w+)*(\S?)))|(\w+((\S)\w+)*(\S?))/gi);
works on a complex example string like:
Tag1 [[another tag]] moretags tag.one [[her's]] paul's [[david's
meeting]][[feb. 16th asdf]] something [[somethingelse]] somethingelse?
[[something's got's to. No? give!]] period. [[three word tag]]
[wrongtag] wonder's [[[three brackets]]] [one bracket] these's
those.twice.again periods.twice.
tagList[0] = "Tag1"
tagList[1] = "[[another tag]]"
tagList[2] = "moretags"
tagList[3] = "tag.one"
tagList[4] = "[[her's]]"
tagList[5] = "paul's"
tagList[6] = "[[david's meeting]]"
tagList[7] = "[[feb. 16th asdf]]"
tagList[8] = "something"
tagList[9] = "[[somethingelse]]"
tagList[10] = "somethingelse?"
tagList[11] = "[[something's got's to. No? give!]]"
tagList[12] = "period."
tagList[13] = "[[three word tag]]"
tagList[14] = "[wrongtag]"
tagList[15] = "wonder's"
tagList[16] = "[[three brackets]]"
tagList[17] = "[one"
tagList[18] = "bracket]"
tagList[19] = "these's"
tagList[20] = "those.twice.again"
tagList[21] = "periods.twice."
Note that the "[one bracket]" gets parsed to two separate tags, "[one"
and "bracket]" which is how TW would see it.
Oh, and thus is fixed a bug in my mGSDMeetingEnhancementsPlugin!
(http://thinkcreatesolve.biz/mGSDEnhancements.html - shameless plug!)
Cheers,
David Szego
--
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.