specially per @savask's request, put matcher into a function
returns 0 if no match, returns position of pipe character if there is
Merge pull request #156 from mniip/regex

regex fix