In my code I and looking through file /etc/syslog.congf and printing every line that has /var/log in it. I need to turn the if 9$line) into a regex code instead.
You need to match the line correctly (with literals and wildcards, etc). It seems you are only matching an optional '/' and then the literal string 'va' and then zero or more 'r' (greedy) and then the literal string 'lo' and then an optional 'g'.... which is not correct.
First of all, is '/var/log/*' always at the beginning of the line? What comes after?
It is always best to post the text in the file or variable you are trying to match so any member who wants to reply can test what they are doing against the text, not just incomplete fragments.