How can we search for multiple string/regexes dynamically from a variable if value exists and ignore if the filed is null/empty

Hi,

I have a requirement to add two variables (include and exclude) which enable to search multiple string/regexes to check the appropriate logs. For example, If the Exclude field is empty, I would want it to do nothing, otherwise exclude lines that contain the regex in Exclude field. Similarly, if include filed is empty, do nothing, otherwise include lines that contain the regex in include field. But this I need to enable for multiple values not for a single value.

someone please helps me.