If I have a title of Symphonie Fantastique - I. Reveries - Passions and run a tag to tag function with a format string of $regexp(%title%,'^.?\b(Concerto|Symphony|Suite|Sonata|Quartet|Quintet|Trio)\b.*',$1)
It returns Symphonie Fantastique - I. Reveries - Passions, instead of a blank or null string, as I'd expect. Is this expected behavior? Is there a way to get it to return an empty/null string if a match is not found?
My workaround is: $iflonger($trim($regexp(%title%,'^.?\b(Concerto|Symphony|Suite|Sonata|Quartet|Quintet|Trio)\b.*',$1)),0,$regexp(%title%,'^.?\b(Concerto|Symphony|Suite|Sonata|Quartet|Quintet|Trio)\b.*',$1),'')
The regular expression looks for a pattern and if there is a match for the pattern, then the next instruction is carried out.
There is no explicit indicator that a pattern has not been found - it would not be clear to me how often such an event should be triggered and reported.
Also, I would not like the regular expression simply delete the input if no match is found but to leave the input the way it is.
So, your observation that the whole input is returned when there is no match, is correct.