If you're doing it your way
var regexp = /\<synthesis\:\[(.*)\]/
This will cover all text after <synthesis:
it should be
var regexp = /\<synthesis\:\[(.*)\]>/
so that it will stop once it encounters the > character
Not really game breaking for your system, but this is more efficient.
what Yanfly did was:
Enumerate each line of notedata
Check if the line matches any of the tags that he needs to check
So basically, he checked different tags in one go instead of making a new method/function to check each tag. It's actually not a check for multiline tags, but rather a single function check for multiple, completely different tags. The concept will also work for multiline tags too though, but you better find a method to enclose the contents of what you're checking.
That is what the last three checks of yanfly was for, First it checked for the upper tag which denotes the start of the multiline tag, if it finds it, it sets a variable to tell the system that it is now checking a multiline tag. The third line if you see checks if were on multiline mode and performs the correct thing. The second line is for checking the end tag so that the system will now know that we're finished with the multiline tag.
So you can do it like that, Or
On your case, you need to get the part of the data that is inside the <synthesis:> tag first and just enumerate the lines of it to make sure you're getting the correct line since some of the tags you have inside synthesis are pretty common names so multiple systems might be using those same tags.
so basically you'd have something like
var regexp = /\<synthesis\:\[(.*)\]>/
var matchNote = notedata.match(regexp)
if (matchNote not equal to nil, I'm not sure exactly how it's written in JS) {
You do it like how yanfly enumerated per line, but instead of enumerating notedata, you will enumerate matchNote
}
That or you do it like this:
<synthesis_type:>
<synthesis_tabId:>
and so on, so now it's easier to implement the per line checking while also making sure that you won't be fetching the wrong tag/line
Basically, there are multiple ways to do this and it depends on your preferences and which one you find easier to implement.
Personally I hate doing the per line check as I prefer making a retrieval method that retrieves the data everytime I need it so that I can keep it easily working with saved files made before the plugin was made, and also because it's more modular. On the other hand, Yanfly's method is a really efficient one as you avoid checking notes over and over again to match several strings.