I searched for answer and I did not found anything about that. hopefully that you can help me with my question.
So I try to search after string with lookahead conditional based on capture group at the end of a string. It means if the capture group at the end is a match, make the conditional group be with something and if capture group at the end is not a match so with something else.
(?:((?(?=ls)yes|no))\${(?:(?P<type>VAR)\s+)([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*\=\s*(\$\{CALL\s+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\s*\}|\"[^\"]*\"|'[^']*'|[0-9]*|(?:[fF]alse|[tT]rue))\s*\}(?<ls>[^\s]{1}))
Input:
${VAR foo="What"}x
${VAR foo="What"}
yes${VAR foo="What"}
no${VAR foo="What"}x
As you see, it captures the word 'no' if there is something at the end as long it is not \s, but it did not capture the word 'yes' if it is nothing.