Can a variable reference be used on RHS side of JavaRegex condition

Thank you for quick response @Dino-at-Google

Any other suggestions to achieve this ask ?