You have unbalanced parens in your if, the semicolon on that line should be a closing paren.
If I understand correctly what your code is trying to do, you may be interested in my tutorial Building Regex Alternations Dynamically.
In reply to Re: Providing regex using an array
by haukex
in thread Providing regex using an array
by dgrunwal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |