I think I understand what you're trying to do, but I don't think there really is a way to put your question in a general form that the regex engine will understand.
In reply to Re^4: Did regex match fail because of "end of string"?
by Joost
in thread Did regex match fail because of "end of string"?
by moritz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |