Validate Against Multi-Value Fields

Suppose I have one or more default composers. Is there a nice clean regex to compare a new incoming composer against the defaults?


I can obviously parse and search between \\, but I'm hoping for a solution that is more elegant.


A regular expression is not needed, it can be solved using standard functions.

  1. Convert the content from the multi-value tag-field COMPOSERS into a string:

  2. Search the new composer within the string of composers:

  3. If the result from step 2 is zero, then the composer does not exist in the list of composers, otherwise the composer does exist already.

This is a case sensitive proposal.
You can make it case insensitive by using function $lower or $upper.


Your approach is similar in concept to the one I am using, which makes the larger expression within which it is embedded look quite messy and difficult to interpret.

I'm not familiar with the meta concept and was hoping there was some secret magic equation, function or incantation that would accomplish the desired task with fewer leaps of programming logic.

And of course both your approach and my similar regexp approach gives false positives when the comparison is a substring of an existing composer (e.g., it considers composer=university valid when one of the default composers is university of south africa).



Here's one that's a little bit shorter.


My first approach tries to reduce the false match of substrings, but it was not perfect yet, because each COMPOSER value needs a left and a right delimiter to give a distinctive value to compare.
As the delimiter character I proposed the $char(9), because it nearly never exists in a COMPOSER value, but you are free to apply some other seldom used character as a delimiter.

This filterstring works for me:
"$strstr('|'$meta_sep(COMPOSERS,'|')'|','|'%COMPOSER%'|')" GREATER 0

... or equivalent as a formatstring ...